RESTful API for Haru-Fashion e-commerce web application. Developed with NodeJS, Express, TypeScript, Prisma and PostgreSQL.
Here are some of the project's features
- CRUD Operations
- Authentication
- Authorization and RBAC
- Forgot/Reset Password
- Full-Text Search (for products)
Backend: Node, Express, TypeScript
Database: Prisma + PostgreSQL
Testing: Jest
Containerization: Docker
CI/CD: CircleCI
Clone the project
git clone https://github.com/softking0503/haru-api.gitGo to the project directory
cd haru-apiRemove remote origin
git remote remove originInstall dependencies
npm installAdd Environment Variables
add the following environment variables to .env file. (some env var include example values)
Click to expand!
NODE_ENVPORTPOSTGRES_USER=testuserPOSTGRES_PASSWORD=test123POSTGRES_DB=haruJWT_SECRETSMTP_HOSTSMTP_PORTSMTP_USERSMTP_PASSFROM_NAMEFROM_MAILDATABASE_URL="postgresql://testuser:test123@postgres:5432/haru?schema=public"
Migrate and seed database
npx prisma migrate dev --name initnpx prisma db seedCan't reach database server Error ?
- Change @postgres to @localhost in
DATABASE_URLinside .env for a while
DATABASE_URL="postgresql://testuser:test123@postgres:5432/test_db?schema=public"⬇️
DATABASE_URL="postgresql://testuser:test123@localhost:5432/test_db?schema=public"Start the server
npm run devStop the server
npm run dev:downTo run tests, create a file called .env.test at the root of the project.
Then add the following environment variables.
NODE_ENV=testing
DATABASE_URL="postgresql://prisma:prisma@localhost:5437/tests"
Note! dotenv-cli must be installed golbally before running any test
sudo npm install -g dotenv-cliRun the test
npm run testCan't reach database server Error ?
- Run the test again
Stop the test
npm run test:down