NoteTaker API
A full-featured Note Taking API built with FastAPI and SQLite that allows users to create, manage, and organize their notes.
Features
- User authentication with JWT
- Create, read, update, and delete notes
- Tag notes for better organization
- Archive and pin notes
- Search functionality for notes
- RESTful API with Swagger documentation
Tech Stack
- Backend Framework: FastAPI
- Database: SQLite with SQLAlchemy ORM
- Authentication: JWT (JSON Web Tokens)
- Migration Tool: Alembic
- Documentation: Swagger UI, ReDoc
Getting Started
Prerequisites
- Python 3.8+
- pip
Installation
-
Clone the repository:
git clone <repository-url> cd notetaker-api
-
Install dependencies:
pip install -r requirements.txt
-
Run database migrations:
alembic upgrade head
-
Run the development server:
uvicorn main:app --reload
The API will be available at http://localhost:8000
Environment Variables
Set the following environment variables for production:
SECRET_KEY
: A secret key for JWT token generationALGORITHM
: The algorithm used for JWT encoding (default: "HS256")ACCESS_TOKEN_EXPIRE_MINUTES
: Minutes until a token expires (default: 10080 - 7 days)
API Documentation
The API documentation is available at:
- Swagger UI:
http://localhost:8000/docs
- ReDoc:
http://localhost:8000/redoc
Database Schema
User
- id (string): UUID primary key
- email (string): Unique email address
- hashed_password (string): Securely hashed password
- full_name (string): User's full name
- profile_image (string): Profile image filename
- is_active (boolean): Whether the user is active
- is_superuser (boolean): Admin status
- created_at (datetime): Account creation timestamp
- updated_at (datetime): Last update timestamp
Note
- id (string): UUID primary key
- title (string): Note title
- content (text): Note content
- is_archived (boolean): Archive status
- is_pinned (boolean): Pin status
- user_id (string): Foreign key to User
- created_at (datetime): Creation timestamp
- updated_at (datetime): Last update timestamp
Tag
- id (string): UUID primary key
- name (string): Tag name
- color (string): Hex color code
- created_at (datetime): Creation timestamp
NoteTag
- id (string): UUID primary key
- note_id (string): Foreign key to Note
- tag_id (string): Foreign key to Tag
- created_at (datetime): Creation timestamp
API Endpoints
Authentication
POST /api/v1/auth/login
: Login with username and passwordPOST /api/v1/auth/register
: Register a new user
Users
GET /api/v1/users/me
: Get current user infoPUT /api/v1/users/me
: Update current user infoPOST /api/v1/users/me/profile-image
: Upload profile image
Notes
GET /api/v1/notes
: List user notesGET /api/v1/notes/search
: Search notesPOST /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 notePATCH /api/v1/notes/{note_id}/archive
: Archive/unarchive a notePATCH /api/v1/notes/{note_id}/pin
: Pin/unpin a note
Tags
GET /api/v1/tags
: List all tagsPOST /api/v1/tags
: Create a new tagGET /api/v1/tags/{tag_id}
: Get a specific tagPUT /api/v1/tags/{tag_id}
: Update a tagDELETE /api/v1/tags/{tag_id}
: Delete a tag
Description
Languages
Python
99.2%
Mako
0.8%