This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
Debt / Loan Management Application further development from the previous version (Kasbon-JS), using NextJS 14 Full Stack with PostgreSQL or SQLite Database (will be available on another branch).
2024-07-13.12-05-39.mp4
- App Router.
- Next-Auth for Authentication.
- Json Web Token (JWT) to secure sessions.
- MUI DataGrid for better data presentation.
- Multi-Role account, accounts are divided into 2 types: Admin and User (Employees).
- Bcrypt for password hashing.
- API Protection using JWT Token Validation.
- Pages protection using session.
- Admin Master Key authentication for admins to change account passwords and account data.
- Dashboard (Admin & Employee).
- Add debt form (Employee).
- Request Status Page.
- Payment Status Page.
- Export debts to PDF, Excel, JSON.
- Retrieve Monthly debt Report.
- Display the total debt value requested, approved, paid off, and unpaid.
- Help Page containing explanations of each page and how to submit and display data.
- Edit User Account Data.
- Edit Admin Account Data.
- Reset User Account Password.
- Reset Admin Account Password.
Docker compose is available. Use according to image version (PostgreSQL / SQLite) don’t forget about the existing environment variables.
Container Image is available in the repository package (ghcr.io)
- debt-manager-pg : is the version with PostgreSQL
- debt-manager-sqlite : is the version with SQLite
The SQLite version is available in the "SQLiteVersion" branch
SQLite database file is located at /prisma/dev.db
open schema.prisma to change the connection and schema.
Using this SQLite version does not require installing other databases like PostgreSQL or MySQL.
- Clone this repository.
- Open the repository folder on your local PC.
- Change the file
.env.example
>>.env
- Fill in the
NEXTAUTH_SECRET
value usingopenssl rand -base64 32
to generate a secret key and copy it toNEXTAUTH_SECRET
- Fill in the
NEXTAUTH_URL
value withhttp://localhost:3000
if run on a local PC, or another domain if run on hosting/cloud. - Open schema.prisma, if you are using PostgreSQL locally then change the
url=
value toenv("DATABASE_URL")
- Then fill in DATABASE_URL with example value:
postgresql://<account name>:<password>@localhost:<port>/<database name>
- If using PostgreSQL from Vercel, then change the
url=
value toenv("POSTGRES_PRISMA_URL")
and adddirectUrl = env("POSTGRES_URL_NON_POOLING")
below it. - Then fill in the
POSTGRES_PRISMA_URL
value in the.env
file with the URL from PostgreSQL in Vercel, as well as thePOSTGRES_URL_NON_POOLING
value. - Fill in the
ADMIN_KEY
value with your own secret key (this is used so that the admin can change the name/email/password of other accounts.) - Once everything is filled in and correct, run
npm install
. - Then run
npx prisma migrate deploy
. - Then run
npx prisma generate
. - Once done, run
npm run seedadmin
to create an admin account. - Then run
npm run seeduser
to create an user account. - The email and password of both accounts can be seen and changed in
/prisma/seedAdmin.js
and/prisma/seedKaryawan.js
. - Then build the project by running
npm run build
.
- Clone the SQLiteVersion branch repository.
- Open the repository folder on your local PC.
- Change the file
.env.example
>>.env
. - Fill in the
NEXTAUTH_SECRET
value using openssl rand -base64 32 to generate a secret key and copy it toNEXTAUTH_SECRET
. - Fill in the
NEXTAUTH_URL
value withhttp://localhost:3000
if run on a local PC, or another domain if run on hosting/cloud. - Open schema.prisma and make sure that
provider = "sqlite"
andurl = "file:./dev.db"
which means Prisma uses SQLite as the database and the database file is located in/prisma/dev.db
. - Fill in the
ADMIN_KEY
value with your own secret key (this is used so that the admin can change the name/email/password of other accounts.) - Once everything is filled in and correct, run
npm install
. - Then run
npx prisma migrate deploy
. - Then run
npx prisma generate
. - Once done, run
npm run seedadmin
to create an admin account. - Then run
npm run seeduser
to create an user account. - The email and password of both accounts can be seen and changed in
/prisma/seedAdmin.js
and/prisma/seedKaryawan.js
- Then build the project by running
npm run build
.
- Edit Data Admin
- Edit Data Admin API
- Refactor some codes
- Remove Unnecessary files
- Add Help page.
- Add API Documentation.
- Add About Page.
- Sidebar Update.
- Refactor some codes.
- Add more page protection.
- Refactor some codes.
- Remove unused files.
- Add Reset Password for Karyawan.
- Add Reset Password for Admin.
- Add master Key validation for Admin password reset.
- Fix API Endpoint protection error.
- Refactor some codes.
- Rilis pertama.
- PostgreSQL Version.
- All Debt Version (Add, status change, get monthly report, export to pdf ; excel ; json).