- Backend:
- FastAPI for the Python backend API.
- SQLModel for ORM-based SQL database interactions.
- Pydantic for data validation and settings management.
- PostgreSQL as the SQL database.
- FastAPI for the Python backend API.
- Frontend:
- Authentication:
- JWT (JSON Web Token) authentication.
- Testing:
- Pytest for backend testing.
Explore the API documentation at http://127.0.0.1:8000/docs.
.
├── backend/
│ ├── src/
│ │ ├── auth/ # Authentication logic
│ │ ├── core/ # Core configurations
│ │ ├── flashcards/ # Flashcard related endpoints
│ │ ├── users/ # User management
│ │ └── main.py # Application entry point
│ └── tests/ # Backend tests
└── frontend/
├── src/
│ ├── components/ # Reusable UI components
│ ├── hooks/ # Custom React hooks
│ ├── routes/ # Application routes
│ └── client/ # Generated API client
└── public/ # Static assets
- Create a PostgreSQL database:
createdb <dbname>- Set up environment variables in
backend/.env:
PROJECT_NAME=FlashNotes
DOMAIN=localhost
POSTGRES_SERVER=localhost
POSTGRES_USER=<your-username>
POSTGRES_PASSWORD=<your-password>
POSTGRES_DB=<dbname>
FIRST_SUPERUSER=admin@example.com
FIRST_SUPERUSER_PASSWORD=<admin-password>
USERS_OPEN_REGISTRATION=true- Navigate to the backend directory:
cd backend- Make the prestart script executable:
chmod +x prestart.sh- Choose one of the following setup options:
# Install dependencies and run migrations
uv run ./prestart.sh # Run ./prestart.sh to run db migrations
# Start the development server
uv run uvicorn src.main:app --reload# Create and activate virtual environment
uv venv .venv
source .venv/bin/activate
# Install dependencies
uv sync
# Run migrations
./prestart.sh
# Start the development server
uvicorn src.main:app --reloadThe backend server will be available at http://127.0.0.1:8000
- Install dependencies and start the development server:
cd frontend
pnpm install
pnpm run devThe frontend uses a generated TypeScript client to communicate with the backend API. To update the client after making changes to the backend:
- Activate the backend virtual environment:
cd backend
source .venv/bin/activate # For Unix/Linux
# OR
.venv\Scripts\activate # For Windows- Run the client generation script from the project root:
./scripts/generate_client.shThis script will:
- Generate OpenAPI specification from the backend
- Move it to the frontend directory
- Generate the TypeScript client
- Format the generated code
Once the backend is running, access the interactive API documentation at:
- ReDoc: http://127.0.0.1:8000/redoc
- Swagger UI: http://127.0.0.1:8000/docs
- Fork the repository
- Create a new branch for your feature
- Commit your changes
- Push to your branch
- Create a Pull Request
This project is licensed under the MIT License.
