kunmifab / hng11-second-task

Home Page:https://hng11-second-task.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Prisma-based User and Organization Management API

This Node.js project offers a well-structured API for user registration, organization management, and user-organization associations, leveraging Prisma for efficient database interactions.

Key Features:

User Registration: Secure registration with email, password, phone number, first/last name. Enforces unique email and user ID constraints. Organization Management: Create organizations with name and description. Automatically generate organization names based on user's first name. User-Organization Relationships: Users can belong to and create multiple organizations. Data Retrieval (Protected Endpoints): Retrieve a user's own data or data from organizations they belong to/created. Retrieve details of all organizations the user is associated with. Retrieve details of a specific organization. User Addition to Organizations (Protected Endpoint): Add users to existing organizations. Technologies:

Node.js Express.js (or similar framework) Prisma (database interactions) JWT (authentication) (Optional) Unit testing framework (e.g., Jest) Getting Started:

Clone the Repository:

git clone https://github.com/your-username/prisma-user-org-api.git

Replace your-username with your GitHub username. Install Dependencies:

cd prisma-user-org-api npm install Configure Database Connection: Create a .env file or use your preferred environment variable management method and set the following variables: DATABASE_URL: Your database connection URL (refer to Prisma documentation for format). Start the Server:

npm start Usage:

Refer to the API documentation (link or details on access will be provided below) for a complete list of endpoints, request/response formats, and authentication requirements.

Unit Testing:

Unit tests are included in the tests directory. Run them using Jest:

npm test

Further Development:

Implement role-based access control (RBAC) for organizations. Integrate email sending for registration confirmation or password reset. Enhance error handling and logging for a robust application. Security Considerations:

This project is a foundational structure. Adapt and extend it based on your specific security needs. Implement proper password hashing and secure data storage mechanisms. Refer to industry best practices for secure password management. Disclaimer:

This project serves as a starting point for user and organization management. Continuous improvement and security hardening are essential.

Contributing:

We welcome contributions! Please follow standard Pull Request practices.

License:

Enjoy building your user and organization management system with this API!

About

https://hng11-second-task.vercel.app


Languages

Language:JavaScript 100.0%