Skip to content

Shawn-Dong/basic_fullstack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Basic Fullstack Project

A simple fullstack demonstration application with a FastAPI server, a Socket Server backend, and a frontend.

Project Structure

.
├── backend/
│   ├── fastapi_server/
│   │   ├── main.py      # FastAPI application setup
│   │   └── APIs.py      # API endpoint definitions
│   └── socket_server/
│       └── server.py    # Basic HTTP socket server
└── frontend/            # Frontend application

Backend

FastAPI Server

The FastAPI server provides a RESTful API with the following endpoints:

  • GET / - Health check endpoint
  • GET /api/messages - Get all messages
  • GET /api/messages/{message_id} - Get a specific message
  • POST /api/messages - Create a new message

To run the FastAPI server:

cd backend/fastapi_server
python -m uvicorn main:app --reload --port 8001

Once running, you can access the Swagger UI documentation at http://localhost:8001/docs.

Socket Server

A basic HTTP server implemented using Python's socket library, supporting the following endpoints:

  • GET / - Home page
  • GET /api/message - Returns a message as JSON

To run the Socket Server:

cd backend/socket_server
python server.py

The server will run on http://localhost:8000.

Frontend

The frontend application demonstrates communication with both backend servers.

To run the frontend (if it uses npm):

cd frontend
npm install
npm run dev

Development

Prerequisites

  • Python 3.8+
  • Node.js and npm (for frontend)

Installation

  1. Clone the repository

    git clone https://github.com/Shawn-Dong/basic_fullstack.git
    cd basic_fullstack
  2. 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
  3. Set up frontend dependencies

    cd frontend
    npm install

License

This project is for demonstration purposes.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages