- Overview
- Features
- Stack
- Getting Started
- API Documentation
- Security
- Error Handling
- Deployment
- Contributing
The Journal App API is a FastAPI-based backend service that provides a robust platform for users to create, manage, and search personal journal entries. This API supports user authentication, CRUD operations for journal entries, and includes features like audio transcription and full-text search capabilities.
- User registration and authentication
- Create, read, update, and delete journal entries
- Audio transcription for voice journal entries
- Full-text search across journal entries
- Secure password hashing and JWT-based authentication
- CORS support for cross-origin requests
- Health check endpoint for monitoring
- FastAPI: High-performance web framework for building APIs
- Pydantic: Data validation and settings management using Python type annotations
- SQLAlchemy (assumed): ORM for database interactions
- JWT: JSON Web Tokens for secure authentication
- CORS: Cross-Origin Resource Sharing middleware
- Uvicorn: ASGI server for running the application
- Python 3.7+
- pip (Python package manager)
- Virtual environment (recommended)
-
Clone the repository:
git clone https://github.com/Balogunolalere/journal-app-api.git cd journal-app-api
-
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install dependencies:
pip install -r requirements.txt
-
Create a
.env
file in the root directory and add the following variables:PROJECT_NAME=Journal App PROJECT_VERSION=1.0.0 SECRET_KEY=your_secret_key_here ALGORITHM=HS256 ACCESS_TOKEN_EXPIRE_MINUTES=30 DATABASE_URL=your_database_url_here
-
Replace
your_secret_key_here
with a secure random string.
The API documentation is available at /api/docs
(Swagger UI) and /api/redoc
(ReDoc) when the server is running.
POST /token
: Obtain a JWT tokenPOST /register
: Register a new userGET /users/me
: Get current user informationPUT /users/me/password
: Update user passwordDELETE /users/me
: Delete user accountPOST /logout
: Logout (client-side token removal)POST /refresh-token
: Refresh access token
POST /journal/entries
: Create a new journal entryGET /journal/entries/{entry_id}
: Retrieve a specific journal entryPUT /journal/entries/{entry_id}
: Update a journal entryDELETE /journal/entries/{entry_id}
: Delete a journal entryGET /journal/entries
: List all journal entries (paginated)POST /journal/entries/transcribe
: Create a journal entry from audio file
GET /journal/search
: Search journal entries
POST /summarization/summarize
: Summarize the entry
- Passwords are securely hashed before storage
- JWT tokens are used for authentication
- CORS middleware is configured to control access from different origins
- Dependency injection is used to ensure only authenticated users can access protected routes
The API uses FastAPI's built-in exception handling and HTTP status codes to provide clear error messages. Custom exceptions are raised and caught to handle specific error cases.
- Ensure all environment variables are properly set
- Run the application using Uvicorn:
uvicorn main:app --host 0.0.0.0 --port 8000
- For production, consider using a process manager like Gunicorn or deploying with Docker
- Fork the repository
- Create a new branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request