This repository demonstrates a subscription tracker project.The project was built using NodeJS, Express, PostgreSQL, Prisma ORM, Arcjet and Upstash. It is a RestfulAPI project that provides functions like creating a subscription, getting a subscription by a user ID, and many more..
-
Node.js – JavaScript runtime for server-side development
-
Express.js – Fast, minimalist web framework for Node.js
-
JWT (JSON Web Tokens) – Secure authentication and authorization
-
Prisma – Next-generation ORM for database management
-
PostgreSQL – Powerful, open-source relational database
-
Arcjet - Runtime security platform
-
Upstash - Fully managed serverless database platform
-
Zod – TypeScript-first schema validation library
-
Bcryptjs – Password hashing for secure user authentication
-
Dotenv – Environment variable management
Advanced Rate Limiting and Bot Protection: With Arcjet that helps you secure the whole app.
Database Management : Secure and easy database management with Prisma ORM.
JWT Authentication: User CRUD operations and subscription management.
Global Error Handling: Input validation and middleware integration.
Logging Mechanisms: For better debugging and monitoring.
Email Reminders: Automating smart email reminders with workflows using Upstash.
and many more, including code architecture and reusability.
-
Node.js (v18 or higher)
-
PostgreSQL (v14 or higher)
Cloning the Repository
git clone https://github.com/aysegules/subscription-tracker.git
cd subscription-trackerInstallation
Install the project dependencies using npm:
npm installSet Up Environment Variables
Create a new file named .env in the root of your project and add the following content:
#PORT
PORT = 5500
VERSION = "/api/v1"
SERVER_URL = "http://localhost:5500"
NODE_ENV = "development/production"
#DATABASE URL
DATABASE_URL="postgresql://username:password@localhost:5432/DB_name?schema=public"
#JWT AUTH
JWT_SECRET="secret"
JWT_EXPIRES_IN="1d"
#ARCJET
ARCJET_KEY = "ajkey"
ARCJET_ENV="development"
#UPSTASH
QSTASH_URL="q-url"
QSTASH_TOKEN="q-token"
QSTASH_CURRENT_SIGNING_KEY="q-kwy"
QSTASH_NEXT_SIGNING_KEY="q-sign-key"
QSTASH_DEV=true
#NODEMAILER
GOOGLE_ACCOUNT="account"
EMAIL_PASSWORD="app password"For the JWT secret variable you can run following command in terminal in your VS Code editor:
openssl rand -base64 32This command will give you a secret key that generated randomly.
Set Up The Database
npx prisma migrate dev --name init
npx prisma generate
npm run seed:subscriptionsStart the Development Server
npm run devOpen http://localhost:5500/api/v1 in your browser or any HTTP client to test your project.
- Prisma - https://www.prisma.io/
- Arcjet - https://arcjet.com/
- Upstash - https://upstash.com/