This is a loan management application built with Next.js, Prisma, and PostgreSQL. The application provides functionalities to manage loans, including creating, fetching, updating, and deleting loan records. It also supports user-specific loan management, including tracking loan status and deletion timestamps.
- Loan Management: Create, update, view, and delete loans.
- Prisma ORM: Interacts with PostgreSQL database using Prisma.
- CRUD Operations: Full Create, Read, Update, Delete capabilities for loan records.
- Loan Validation: Input validation when creating or updating loans.
- Loan Status Tracking: Track the status of loans (e.g.,
Pending,Approved,Rejected). - Soft Deletion: Loans are not physically deleted; instead, a
deletedAttimestamp is added to mark deleted records.
- Frontend: React (Next.js)
- Backend: Node.js with Next.js API routes
- Database: PostgreSQL with Prisma ORM
- State Management: React's
useStateanduseEffect - Styling: Tailwind CSS
- Logging: Custom logging for error tracking and debugging
- Environment Variables: Managed via
.envfile
Ensure you have the following installed:
- Node.js (version >= 16.x)
- PostgreSQL (version >= 12.x)
- Prisma ORM (handled via dependencies)
Follow the steps below to set up and run the project locally:
Start by cloning the repository to your local machine:
https://github.com/aiscodes/loan-management-app
cd loan-management-appMake sure you have Node.js installed. Then, install the project dependencies by running:
make installThis command will install all necessary dependencies via npm.
Make sure you have PostgreSQL set up locally or remotely, and update the DATABASE_URL and SHADOW_DATABASE_URL in your .env file with the correct credentials.
- DATABASE_URL="postgresql://user:password@localhost:5432/loan_app_db"
- SHADOW_DATABASE_URL="postgresql://user:password@localhost:5432/loan_app_db_shadow"
After setting up your environment variables, generate the Prisma Client and run the initial migrations:
make migrationsThis command will create the database tables based on your Prisma schema.
To build the project for production, run:
make buildTo start the project in development mode, run:
make startThis will run the development server at http://localhost:3000.
The project includes a Makefile to automate common tasks. Here are the available commands:
- install: Install project dependencies.
- migrations: Generate Prisma Client and run migrations.
- build: Build the project for production.
- start: Run the project in development mode.
- help: Display the help message with available targets. To get a list of available commands, you can simply run:
make help