
- 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
96 lines
2.4 KiB
Markdown
96 lines
2.4 KiB
Markdown
# 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
|
|
|
|
1. Clone the repository
|
|
|
|
2. Install dependencies:
|
|
```bash
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
3. Run database migrations:
|
|
```bash
|
|
alembic upgrade head
|
|
```
|
|
|
|
4. Start the application:
|
|
```bash
|
|
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 note
|
|
- `GET /api/v1/notes/{note_id}` - Get a specific note
|
|
- `PUT /api/v1/notes/{note_id}` - Update a note
|
|
- `DELETE /api/v1/notes/{note_id}` - Delete a note
|
|
- `POST /api/v1/notes/{note_id}/export` - Export a note to a specific format
|
|
- `GET /health` - Health check endpoint
|
|
|
|
## Development
|
|
|
|
### Linting
|
|
|
|
The project uses Ruff for linting and formatting:
|
|
|
|
```bash
|
|
ruff check .
|
|
ruff format .
|
|
``` |