Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Priyanshu471/ad-management/llms.txt

Use this file to discover all available pages before exploring further.

This guide walks you through everything needed to run the Ad Management System on your local machine. By the end you will have a fully working Next.js dev server connected to MongoDB, and you will be able to register accounts for all three roles — Admin, Advertiser, and Creator — and explore their respective dashboards.
1

Prerequisites

Before you begin, make sure the following are available on your machine:
  • Node.js 18 or higher — the project targets Next.js 14, which requires Node 18+. Run node -v to check your version.
  • npm — bundled with Node.js. Run npm -v to verify.
  • MongoDB — either a free MongoDB Atlas cluster (recommended) or a locally running MongoDB instance. You will need a connection URI in the next steps.
2

Clone the Repository and Install Dependencies

Clone the repository from GitHub and install all npm dependencies:
git clone https://github.com/Priyanshu471/ad-management.git
cd ad-management
npm install
The install step pulls in Next.js 14, Mongoose, Zustand, ApexCharts, EdgeStore, Sonner, Zod, shadcn/ui, and all other dependencies listed in package.json.
3

Configure Environment Variables

The application requires a .env.local file at the project root for database connectivity. Create the file and populate it with the following variable:
.env.local
MONGO_URI=mongodb+srv://<username>:<password>@cluster.mongodb.net/ad-management
Replace <username> and <password> with your MongoDB Atlas credentials, or swap the URI for your local MongoDB connection string (e.g. mongodb://localhost:27017/ad-management). This variable is read by lib/mongodb.js to open the Mongoose connection.
Use the MongoDB Atlas free tier (M0) for zero-configuration cloud hosting. It requires no local MongoDB installation, provides 512 MB of storage at no cost, and gives you a ready-to-use connection string from the Atlas dashboard the moment you create a cluster.
4

Start the Development Server

Run the Next.js development server:
npm run dev
Next.js will compile the application and start listening on port 3000. You should see output similar to:
▲ Next.js 14.1.0
- Local: http://localhost:3000
✓ Ready in Xs
5

Open the App and Register an Account

Open http://localhost:3000 in your browser. You will land on the login page.Navigate to http://localhost:3000/register to create your first account. The registration form asks for your name, email, password, and role — choose one of:
  • admin — access the Admin panel (user management, system settings, finances)
  • advertiser — access the Advertiser dashboard (campaigns, analytics, media)
  • creator — access the Creator dashboard (profile, campaigns, analytics, earnings)
After registration, you are automatically logged in and redirected to your role’s dashboard. Repeat the registration step with different email addresses to create accounts for the other two roles.

Available Routes

Once the server is running, the following routes are available:
RouteDescription
/Login page — entry point for all users
/registerRegistration page with role selection (admin, advertiser, creator)
/advertiserAdvertiser dashboard: overview, create campaign, campaigns list, analytics, media library
/creatorCreator dashboard: overview, profile, campaigns, analytics, media library
/adminAdmin panel: dashboard, users, manage, system settings, finances
Routes under /advertiser, /creator, and /admin are role-guarded. Attempting to access a portal without the matching role will redirect you back to the login page.
Zustand stores are held entirely in JavaScript memory and are not persisted to localStorage or cookies. This means all authentication state — including the logged-in user’s name, email, and role — resets when the page is fully reloaded. After a hard refresh you will need to log in again via the / login page. This is expected behavior in the current implementation; see the Architecture page for details on adding persistent session handling.

Build docs developers (and LLMs) love