CodeDrop is a full-stack web application designed for instantly purchasing digital gift codes. Users can securely log in, browse available codes, purchase them using Stripe, and receive the codes directly in their email.
CodeDrop provides a seamless user experience, from browsing products to receiving your gift code.
The main landing page highlights the purpose of the application and encourages users to explore the available products.
Users can browse a catalog of available digital gift codes. Each card includes a brief description and price.
Once a user selects a product, they are taken to a product page. The payment process is seamless and secure, powered by Stripe.
After a successful purchase, a confirmation message appears, and the purchased gift code is sent immediately to the user's registered email address.
Users can easily view a history of all their past purchases, including the products bought and the date of the transaction.
The purchased codes are delivered directly to the user's inbox in a clean, easy-to-read format.
| Category | Technology |
|---|---|
| Backend | Node.js, Express, TypeScript |
| Frontend | React, Vite, TypeScript (assumed) |
| Database | PostgreSQL |
| ORM | Drizzle ORM |
| Authentication | Passport.js (Google OAuth 2.0 Strategy) |
| Payments | Stripe |
| Nodemailer |
Follow these instructions to get a copy of the project up and running on your local machine for development and testing purposes.
Before you begin, you will need to have the following installed and configured:
- Node.js (v18 or later)
- npm or yarn
- PostgreSQL database instance
- Stripe Account: To get your
STRIPE_SECRET_KEY. - Stripe CLI: For testing webhooks locally.
- Google Cloud Platform Account: To get your
GOOGLE_CLIENT_IDandGOOGLE_CLIENT_SECRET. - Gmail Account: With an "App Password" for Nodemailer (
MAIL_USER,MAIL_PASS).
1. Clone the Repository
git clone https://github.com/your-username/codedrop.git
cd codedrop2. Backend Setup
Navigate to the backend directory (let's assume it's /backend).
cd backend
npm install3. Environment Variables
Create a .env file in the /backend directory by copying the example file.
cp .env.example .envNow, open the .env file and fill it with your credentials:
# Server Configuration
PORT=5000
SERVER_BASE_URL=http://localhost:5000
FRONTEND_BASE_URL=http://localhost:5173
# Stripe Keys
STRIPE_SECRET_KEY=sk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...
# Google OAuth Credentials
GOOGLE_CLIENT_ID=...
GOOGLE_CLIENT_SECRET=...
# Session Management
SESSION_SECRET=your_strong_session_secret
# Nodemailer (Gmail) Credentials
MAIL_USER=your-email@gmail.com
MAIL_PASS=your_gmail_app_passwordNote: For
MAIL_PASS, you must generate an App Password from your Google Account security settings, not your regular login password.
4. Database Setup
Run the following commands in order from the /backend directory to set up your PostgreSQL database with the required schema and seed data.
# 1. Generate Drizzle ORM migration files
npm run generate
# 2. Push the schema to your database
npm run push
# 3. Seed the database with initial products
npm run seed5. Frontend Setup
Navigate to the frontend directory (let's assume it's /frontend).
cd ../frontend
npm install(You may also need a .env file in the frontend to point to the backend API URL, e.g., VITE_API_URL=http://localhost:5000/api)
You will need to run three processes in separate terminal windows.
1. Start the Backend Server
From the /backend directory:
npm run devYour backend API will be running on
http://localhost:5000.
2. Start the Frontend Development Server
From the /frontend directory:
npm run devYour frontend will be accessible at
http://localhost:5173.
3. Start the Stripe CLI for Webhooks To process payment events locally, run:
stripe listen --forward-to http://localhost:5000/api/stripe/webhookThis command will give you a webhook secret (
whsec_...). Copy this secret and place it in your backend.envfile as theSTRIPE_WEBHOOK_SECRET.
You can now open your browser to http://localhost:5173 and use the application.
Here is a list of useful scripts from package.json in the /backend directory:
| Script | Description |
|---|---|
npm run dev |
Starts the backend server in development mode. |
npm run generate |
Generates Drizzle ORM migration files based on schema changes. |
npm run push |
Pushes the current schema to the PostgreSQL database. |
npm run seed |
Populates the database with initial product data. |
npm run del |
Clears all products from the database. |
npm run del2 |
Warning: Clears all data from all tables. |
This project is licensed under the MIT License.





