
- Set up project structure with FastAPI - Create database models for notes - Implement Alembic migrations - Create API endpoints for note CRUD operations - Implement note export functionality (markdown, txt, pdf) - Add health endpoint - Set up linting with Ruff
Notes Management Platform
A platform to store and download notes in various formats.
Features
- Create, read, update, and delete notes
- Export notes in different formats:
- Markdown (.md)
- Plain text (.txt)
- PDF (.pdf)
- Search notes by title or content
Tech Stack
- Framework: FastAPI
- Database: SQLite
- ORM: SQLAlchemy
- Migrations: Alembic
- Export: Markdown, WeasyPrint (PDF)
Project Structure
.
├── alembic.ini # Alembic configuration
├── app/ # Application package
│ ├── api/ # API endpoints
│ ├── core/ # Core functionality (config, etc.)
│ ├── crud/ # CRUD operations
│ ├── db/ # Database setup
│ ├── models/ # SQLAlchemy models
│ ├── schemas/ # Pydantic schemas
│ ├── services/ # Business logic
│ └── utils/ # Utility functions
├── main.py # FastAPI application entry point
├── migrations/ # Alembic migrations
│ ├── env.py # Alembic environment
│ ├── script.py.mako # Migration script template
│ └── versions/ # Migration scripts
└── requirements.txt # Project dependencies
Setup and Installation
Prerequisites
- Python 3.8+
- pip (Python package installer)
Installation
-
Clone the repository
-
Install dependencies:
pip install -r requirements.txt
-
Run database migrations:
alembic upgrade head
-
Start the application:
uvicorn main:app --host 0.0.0.0 --port 8000 --reload
API Usage
Once the application is running, you can interact with the API using the Swagger UI at:
http://localhost:8000/docs
Available Endpoints
GET /api/v1/notes
- List all notes (with optional search and pagination)POST /api/v1/notes
- Create a new noteGET /api/v1/notes/{note_id}
- Get a specific notePUT /api/v1/notes/{note_id}
- Update a noteDELETE /api/v1/notes/{note_id}
- Delete a notePOST /api/v1/notes/{note_id}/export
- Export a note to a specific formatGET /health
- Health check endpoint
Development
Linting
The project uses Ruff for linting and formatting:
ruff check .
ruff format .
Description
Languages
Python
96.7%
Mako
3.3%