This project is a backend implementation for managing financial assistance schemes for needy individuals and families. It includes functionalities for managing applicants, applications, and schemes, along with administrative user roles.
- Applicants Management: Add and view applicants, including their household members.
- Schemes Management: View all available financial assistance schemes.
- Applications Management: Create and view applications for schemes based on applicant eligibility.
- Eligibility Checking: Automatically checks applicant eligibility for schemes based on criteria.
- Authentication: JWT-based authentication for secure access to the API.
- Backend: Node.js, Express.js
- Database: PostgreSQL
- Authentication: JWT
- API Documentation & Input Validation: OpenAPI
- Node.js (v20)
- PostgreSQL (v16)
- NPM (v10)
-
Clone the repository:
git clone <repository-url> cd <repository-directory>
-
Install dependencies:
npm install
-
Set up environment variables: Create a
.env
file in the root directory with the following content:DATABASE_URL=postgres://<username>:<password>@<host>:<port>/<database> JWT_SECRET=<your-secret-key> PORT=3000
-
Setup DB schema:
- Execute the SQL script located at
sql/db_setup.sql
to create the necessary database schema. - Ensure that your database account has write access to all the tables created by this script.
- Execute the SQL script located at
-
(Optional) Insert Sample Data:
- You can optionally create a sample scheme and administrator by executing the
sql/test_data.sql
script.
- You can optionally create a sample scheme and administrator by executing the
-
Start the server:
npm start
- POST /api/mockLogin
- Mock login to generate JWT token.
- GET /api/applicants
- Retrieve all applicants with pagination.
- POST /api/applicants
- Create a new applicant.
- GET /api/schemes
- Retrieve all schemes with pagination.
- GET /api/schemes/eligible?applicant={id}
- Retrieve all schemes that an applicant is eligible to apply for.
- GET /api/applications
- Retrieve all applications with pagination.
- POST /api/applications
- Create a new application.
The system uses the following tables:
- Administrators: Information about users managing the system.
- Applicants: Details of individuals applying for financial assistance.
- HouseholdMembers: Family members staying in the same household as the applicant.
- Schemes: Information about available financial assistance schemes.
- SchemeCriteria: Criteria associated with schemes for eligibility checking.
- Benefits: Benefits associated with each scheme.
- Applications: Records and statuses of applications made by applicants.
This project is licensed under the GPL V3 License.