A simple fullstack demonstration application with a FastAPI server, a Socket Server backend, and a frontend.
.
├── backend/
│ ├── fastapi_server/
│ │ ├── main.py # FastAPI application setup
│ │ └── APIs.py # API endpoint definitions
│ └── socket_server/
│ └── server.py # Basic HTTP socket server
└── frontend/ # Frontend application
The FastAPI server provides a RESTful API with the following endpoints:
GET /- Health check endpointGET /api/messages- Get all messagesGET /api/messages/{message_id}- Get a specific messagePOST /api/messages- Create a new message
To run the FastAPI server:
cd backend/fastapi_server
python -m uvicorn main:app --reload --port 8001Once running, you can access the Swagger UI documentation at http://localhost:8001/docs.
A basic HTTP server implemented using Python's socket library, supporting the following endpoints:
GET /- Home pageGET /api/message- Returns a message as JSON
To run the Socket Server:
cd backend/socket_server
python server.pyThe server will run on http://localhost:8000.
The frontend application demonstrates communication with both backend servers.
To run the frontend (if it uses npm):
cd frontend
npm install
npm run dev- Python 3.8+
- Node.js and npm (for frontend)
-
Clone the repository
git clone https://github.com/Shawn-Dong/basic_fullstack.git cd basic_fullstack -
Set up Python environment
# Optional: Create a virtual environment python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate # Install backend dependencies pip install fastapi uvicorn
-
Set up frontend dependencies
cd frontend npm install
This project is for demonstration purposes.