57 lines
1.2 KiB
Markdown
57 lines
1.2 KiB
Markdown
# User Authentication Service
|
|
|
|
A secure user authentication API built with FastAPI and SQLite.
|
|
|
|
## Features
|
|
|
|
- User registration with email validation
|
|
- Secure password hashing using bcrypt
|
|
- JWT token-based authentication
|
|
- Protected routes with authentication middleware
|
|
- Health check endpoint
|
|
- SQLite database with Alembic migrations
|
|
|
|
## Setup
|
|
|
|
1. Install dependencies:
|
|
```bash
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
2. Set environment variables:
|
|
```bash
|
|
export SECRET_KEY="your-secret-key-here"
|
|
```
|
|
|
|
3. Run the application:
|
|
```bash
|
|
uvicorn main:app --reload
|
|
```
|
|
|
|
## API Endpoints
|
|
|
|
### Authentication
|
|
- `POST /auth/register` - Register new user
|
|
- `POST /auth/login` - Login user
|
|
- `GET /auth/profile` - Get current user profile (protected)
|
|
|
|
### System
|
|
- `GET /` - Service information
|
|
- `GET /health` - Health check
|
|
- `GET /docs` - API documentation
|
|
- `GET /openapi.json` - OpenAPI schema
|
|
|
|
## Environment Variables
|
|
|
|
The following environment variables should be set:
|
|
|
|
- `SECRET_KEY` - JWT secret key for token signing (required for production)
|
|
|
|
## Database
|
|
|
|
The application uses SQLite database located at `/app/storage/db/db.sqlite`. Database migrations are managed with Alembic.
|
|
|
|
## Documentation
|
|
|
|
API documentation is available at `/docs` when the application is running.
|