57 lines
1.4 KiB
Markdown

# User Authentication Service
A FastAPI-based user authentication service with JWT token authentication and SQLite database.
## Features
- User registration and login
- JWT token-based authentication
- Password hashing with bcrypt
- SQLite database with SQLAlchemy ORM
- Alembic database migrations
- CORS enabled for all origins
- Health check endpoint
## API Endpoints
- `GET /` - Service information and links
- `GET /health` - Health check endpoint
- `POST /auth/register` - User registration
- `POST /auth/login` - User login
- `GET /auth/me` - Get current user profile (requires authentication)
- `GET /docs` - Interactive API documentation
- `GET /redoc` - Alternative API documentation
## Setup
1. Install dependencies:
```bash
pip install -r requirements.txt
```
2. Set environment variables:
```bash
export SECRET_KEY="your-secret-key-here"
```
**Note:** The SECRET_KEY environment variable is required for JWT token generation. Make sure to set it to a secure random string in production.
3. Run database migrations:
```bash
alembic upgrade head
```
4. Start the application:
```bash
uvicorn main:app --reload
```
The application will be available at `http://localhost:8000`
## Environment Variables
- `SECRET_KEY` - Secret key for JWT token signing (required)
## Database
The application uses SQLite database stored at `/app/storage/db/db.sqlite`. The database directory will be created automatically on first run.