This project is a simple user management system backend built using FastAPI and Firebase. The system provides APIs for user registration, login, profile management, and user deletion. Firebase is used for user authentication and Firestore for data storage.
- Getting Started
- Authentication
- API Endpoints
- User Registration
- User Login
- User Profile
- User Deletion
- Validation and Security
- Error Handling
- Testing
- Deployment
- Conclusion
- Clone this repository.
- Create and activate a virtual environment (recommended).
- Install project dependencies using
pip install -r requirements.txt
. - Set up your Firebase project and obtain the necessary credentials.
- Configure your environment variables for Firebase.
User authentication is handled through Firebase. Firebase Authentication provides secure user registration and login. Refer to Firebase Authentication for more information.
The following API endpoints are available:
/register
: Register a new user./login
: Log in an existing user./profile
: Retrieve and update user profiles./delete
: Delete a user account.
- Send a POST request to
/register
with user information. - The user will be created in Firebase and their data stored in Firestore.
- Passwords are securely stored in Firebase and not in Firestore.
- Send a POST request to
/login
with user credentials. - On successful login, a Firebase Auth token is returned.
- Send a GET request to
/profile
to retrieve user profile information. - Send a PUT request to
/profile
to update user profile information.
- Send a DELETE request to
/delete
to request the deletion of your account.
- Input validation is implemented for all user inputs.
- API endpoints are secured to ensure only authenticated users can access their profiles.
Common error responses are defined for different scenarios to help you diagnose issues.
- Use tools like Postman to test the API endpoints.
- Sample test cases and expected results are provided in the code documentation.
- Deploy the application to a production environment of your choice.
- Make sure to set the appropriate environment variables.
This user management system provides essential features for user registration, login, profile management, and account deletion. It ensures the security and privacy of user data by using Firebase for authentication and Firestore for storage.