Documentation
๐ API Reference
Authentication
POST /api/auth/register
Register a new user.
Request Body:
{
"email": "user@example.com",
"password": "securepassword",
"name": "John Doe"
}Response:
{
"user": {
"id": "123",
"email": "user@example.com",
"name": "John Doe"
},
"token": "jwt_token_here"
}POST /api/auth/login
Authenticate a user.
Request Body:
{
"email": "user@example.com",
"password": "securepassword"
}Response:
{
"user": {
"id": "123",
"email": "user@example.com",
"name": "John Doe"
},
"token": "jwt_token_here"
}Users
GET /api/users/:id
Get user by ID.
Headers:
Authorization: Bearer jwt_token_hereResponse:
{
"id": "123",
"email": "user@example.com",
"name": "John Doe",
"createdAt": "2023-01-01T00:00:00.000Z"
}๐ง Configuration
Environment Variables
# Database
DATABASE_URL="postgresql://user:password@localhost:5432/dbname"
# Authentication
NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET="your-secret-key"
# API
API_URL="http://localhost:3001"๐งช Testing
Run the test suite:
npm run testRun tests with coverage:
npm run test:coverage๐ Deployment
Vercel Deployment
- Push your code to GitHub
- Import the project in Vercel
- Configure environment variables
- Deploy
Manual Deployment
- Build the application
npm run build- Start the production server
npm start๐ค Contributing
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
๐ License
MIT License - see LICENSE file for details.