A web-based platform that enables merchants to manage and activate their own online advertisement campaigns using a credit-based system.
- Kangning Li
- Kewen Xu
CS5610 - Web Development https://johnguerra.co/classes/webDevelopment_online_fall_2025/
Build a comprehensive advertisement management platform where merchants can:
- Register and manage their accounts
- Purchase and manage advertisement credits
- Create, activate, and monitor advertisement campaigns
- View transaction history and analytics
- Simulate advertisement interactions
- User Authentication: Secure registration and login system
- Credit Management: Virtual credit system for ad campaign funding
- Advertisement Types:
- E-commerce Link Ads (10 credits/day)
- App Download Ads (15 credits/day)
- Web Banner Ads (20 credits/day)
- Campaign Management: Full CRUD operations for advertisement campaigns
- Transaction History: Complete audit trail of all credit transactions
- Ad Performance: Track impressions and clicks for active campaigns
- Frontend: Vanilla JavaScript with ES6 modules
- Backend: Node.js + Express
- Database: MongoDB with proper indexing and validation
- Session Management: Express-session for authentication
- Code Quality: ESLint and Prettier configuration
- Responsive Design: Mobile-friendly interface
Main dashboard showing campaign statistics and credit management
π Live Demo: http://47.252.30.228:3000/
Test Account:
- Username:
testUser - Password:
test123
- Frontend: HTML5, CSS3, Vanilla JavaScript (ES6 modules)
- Backend: Node.js + Express
- Database: MongoDB
- Session Management: express-session
- Code Quality: ESLint + Prettier
- Node.js (v18 or higher)
- MongoDB (Community Edition)
- Git
-
Clone the repository
git clone <repository-url> cd 5600Project2
-
Install dependencies
npm install
-
Set up MongoDB
# Start MongoDB service brew services start mongodb/brew/mongodb-community # Create database and collections npm run setup-db # Seed with test data npm run seed-db
-
Configure environment
cp .env.example .env # Edit .env file with your configuration -
Start the application
npm start
-
Access the application
- Open your browser and navigate to
http://localhost:3000 - Use test account: username
techstore_owner, passwordpassword123
- Open your browser and navigate to
- Registration: Click "Register" tab and create a new account
- Dashboard: View your account statistics and credit balance
- Create Ads: Navigate to "Ad Management" and create your first campaign
- Activate Campaigns: Use credits to activate your advertisements
- Monitor Performance: Track impressions and clicks in real-time
- Login: Use your credentials to access the dashboard
- Recharge Credits: Add more credits to fund campaigns
- Manage Campaigns: Create, activate, pause, or delete advertisements
- View History: Check transaction history and export data
POST /api/register- User registrationPOST /api/login- User loginPOST /api/logout- User logoutGET /api/user- Get current user info
GET /api/ads- Get user's advertisementsPOST /api/ads- Create new advertisementPOST /api/ads/:id/activate- Activate advertisementDELETE /api/ads/:id- Delete advertisementPOST /api/ads/:id/click- Simulate ad click
POST /api/recharge- Recharge creditsGET /api/transactions- Get transaction history
{
_id: ObjectId,
username: String (unique, indexed),
email: String (unique, indexed),
password_hash: String,
credits: Number (default: 100),
role: String (default: 'merchant'),
status: String (default: 'active', indexed),
createdAt: Date (indexed),
updatedAt: Date,
lastLoginAt: Date
}{
_id: ObjectId,
merchantId: ObjectId (indexed),
title: String,
type: String, // 'ECOMMERCE', 'APP', 'BANNER'
status: String (indexed), // 'draft', 'active', 'paused'
targetUrl: String,
bannerImageUrl: String,
appStoreUrl: String,
googlePlayUrl: String,
costPerDay: Number, // 10/15/20 based on type
budgetCredits: Number,
metrics: {
impressions: Number (default: 0),
clicks: Number (default: 0)
},
createdAt: Date (indexed),
updatedAt: Date,
startDate: Date
}{
_id: ObjectId,
merchantId: ObjectId (indexed),
adId: ObjectId (optional, indexed),
type: String, // 'CREDIT_RECHARGE', 'AD_ACTIVATE'
amount: Number, // positive for recharge, negative for spending
balanceAfter: Number,
note: String,
source: String, // 'user', 'system'
createdAt: Date (indexed)
}- Indexing: Optimized queries with strategic indexes on frequently searched fields
- Validation: Schema validation ensures data integrity
- Relationships: Proper foreign key relationships between collections
- Performance: Compound indexes for complex queries
See database/setup.js for detailed schema definitions.
# Run linting
npm run lint
# Fix linting issues
npm run lint:fix
# Format code
npm run format# Reset and setup database
npm run setup-db
# Add test data
npm run seed-dbβββ server.js # Main Express server
βββ package.json # Project configuration
βββ database/ # Database setup and schemas
β βββ setup.js # Database initialization
β βββ seed.js # Test data seeding
βββ public/ # Frontend assets
β βββ css/ # Stylesheets
β βββ js/ # JavaScript modules
β βββ login.html # Login page
β βββ dashboard.html # Main application
βββ .eslintrc.js # ESLint configuration
βββ .prettierrc # Prettier configuration
βββ README.md # This file
This project utilized Large Language Models to enhance development efficiency and documentation quality:
- Project Framework Setup: Used for initial project architecture design and scaffolding
- Documentation Writing: Used for creating comprehensive documentation and README content
MIT License - see LICENSE file for details
This is a class project. For issues or suggestions, please contact the author.
Note: This project uses simulated payment processing. No real financial transactions are processed.