A robust, cloud-native user authentication service built with Django REST Framework, designed for CSYE-6225 Network Structures and Cloud Computing (Spring 2024).
- User Authentication and Authorization
- RESTful API Endpoints
- PostgreSQL Database Integration
- Health Check Endpoint
- Cloud-Native Architecture
- Serverless Microservice Support
- Comprehensive Test Coverage
- Backend Framework: Django 4.x
- API Framework: Django REST Framework
- Database: PostgreSQL
- Authentication: JWT (JSON Web Tokens)
- Cloud Services: Google Cloud Platform
- Testing: pytest
- Documentation: drf-yasg (Swagger/OpenAPI)
- Python 3.x
- Pipenv
- PostgreSQL
- Google Cloud Platform Account (for cloud deployment)
- Install Pipenv:
pip install pipenv
- Clone the repository:
git clone https://github.com/shreyagupta30/webapp-csye6225.git
cd webapp-csye6225
- Activate the virtual environment:
pipenv shell
- Install dependencies:
pipenv install
- Create a PostgreSQL database:
CREATE DATABASE your_database_name;
- Grant privileges:
GRANT ALL PRIVILEGES ON your_database_name TO your_username;
- Configure environment variables:
Create a
.env
file in the root directory:
DEBUG='True'
DB_HOST=localhost
DB_NAME=<your_database_name>
DB_USER=<your_username>
DB_PASSWORD=<your_password>
DB_PORT=5432
- Apply database migrations:
python manage.py makemigrations
python manage.py migrate
- Start the development server:
python manage.py runserver
GET /healthz
Returns HTTP 200 if the service is healthy.
POST /v1/user
Content-Type: application/json
{
"username": "[email protected]",
"firstname": "John",
"lastname": "Doe",
"password": "secure_password"
}
GET /v1/user/self
Authorization: Bearer <jwt_token>
PUT /v1/user/self
Authorization: Bearer <jwt_token>
Content-Type: application/json
{
"firstname": "John",
"lastname": "Smith",
"password": "new_password"
}
Run the test suite:
pytest
The application is designed for cloud deployment with the following features:
- Packer configuration for AMI creation
- GitHub Actions for CI/CD
- Serverless microservice support
- Health check monitoring
- Passwords are hashed using bcrypt
- JWT-based authentication
- Environment variable configuration for sensitive data
- Input validation and sanitization
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is part of the CSYE-6225 course at Northeastern University.