REQUIREMENTS
You must have:
- Node and PostgreSQL installed on your PC.
- Stripe account for payment feature.
- Optional: Cloudinary account to opt in saving images in cloud. (By default, images are saved locally.)
- Optional: Code Editor eg; VS Code.
- Download .zip file or clone the app with :
git clone https://github.com/PrashantGM/bookstore-webapp.git
. - Open the project folder in your favorite text editor and run npm install on the terminal.
- Set up stripe account, go to developer's section and get secret key.
Also, set up webhook listener from your terminal by running following commands and get webhook test key.
stripe login stripe listen --forward-to http://localhost:8000/order/stripe/webhook
- Optional: Set up cloudinary account and get its account name, api key and secret.
- Create .env file on project's root directory and include aforementioned keys with other .env variables below:
PORT= <port your app is listening to>
CLOUD_NAME= <your cloudinary account name>
CLOUD_API_KEY= <your cloudinary api key>
CLOUD_API_SECRET= <your cloudinary api secret>
JWT_SECRET= <secret for signing jwt token>
JWT_LIFE_TIME= <life time of jwt token eg;1d>
STRIPE_KEY= <stripe secret key>
WEBHOOK_TEST_KEY= <test key for stripe webhook>
- Run npx prisma migrate dev on the terminal.
- Then, execute npm run dev. App will be live on http://localhost:8000.
Notice:
- If optional requirements weren't applied, relevant source code must be disabled to avoid errors.
- First user registered is assigned with admin role.