Skip to content

dipanshurdev/devpath

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

215 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

DevPath πŸ—ΊοΈ

DevPath is a modern SaaS learning platform where developers can explore curated roadmaps, track their progress, and master new skills. Built with Next.js 14 App Router, MongoDB, Prisma, and NextAuth.


Tech Stack

Layer Technology
Framework Next.js 14 (App Router)
Database MongoDB Atlas
ORM Prisma
Auth NextAuth.js v4 (JWT + OAuth)
UI Tailwind CSS + shadcn/ui
Roadmap Visualization ReactFlow
Animations Framer Motion
Validation Zod
Caching In-memory (Redis optional)

Getting Started

1. Clone and install

git clone https://github.com/dipanshurdev/devpath.git
npm install

2. Configure environment variables

Copy .env.example to .env and fill in the required values:

cp .env.example .env

Required variables:

DATABASE_URL=mongodb+srv://...
NEXTAUTH_SECRET=your-secret-here
NEXTAUTH_URL=http://localhost:3000

Optional (for OAuth):

GITHUB_ID=...
GITHUB_SECRET=...
GOOGLE_CLIENT_ID=...
GOOGLE_CLIENT_SECRET=...

3. Set up the database

# Push schema to MongoDB and generate Prisma client
npm run setup:prisma

# Seed with sample roadmaps and an admin user
npm run db:seed

Default admin credentials (override via env):

  • Email: admin@devpath.dev
  • Password: Admin@123456

4. Run the development server

npm run dev

Open http://localhost:3000.


Available Scripts

Script Description
npm run dev Start development server
npm run build Build for production
npm run start Start production server
npm run lint Run ESLint
npm run lint:fix Run ESLint and auto-fix
npm run type-check Run TypeScript type checking
npm run prisma:generate Regenerate Prisma client
npm run prisma:push Push schema changes to DB
npm run prisma:studio Open Prisma Studio (DB GUI)
npm run setup:prisma Generate + push schema
npm run db:seed Seed database with sample data
npm run db:reset Reset DB and re-seed
npm run db:import Import roadmaps from JSON file

Project Structure

devpath/
β”œβ”€β”€ app/                        # Next.js App Router pages and API routes
β”‚   β”œβ”€β”€ api/                    # API route handlers
β”‚   β”‚   β”œβ”€β”€ admin/stats/        # Admin stats endpoint
β”‚   β”‚   β”œβ”€β”€ auth/               # NextAuth + registration
β”‚   β”‚   β”œβ”€β”€ dashboard/          # Dashboard data
β”‚   β”‚   β”œβ”€β”€ roadmaps/           # Roadmap CRUD, likes, bookmarks, progress
β”‚   β”‚   β”œβ”€β”€ subscriptions/me/   # Current user subscription
β”‚   β”‚   └── users/              # User profile endpoints
β”‚   β”œβ”€β”€ admin/                  # Admin dashboard pages
β”‚   β”œβ”€β”€ dashboard/              # User dashboard
β”‚   β”œβ”€β”€ roadmaps/               # Roadmap list and detail pages
β”‚   β”œβ”€β”€ login/ register/        # Auth pages
β”‚   β”œβ”€β”€ pricing/                # Pricing page
β”‚   β”œβ”€β”€ error.tsx               # Global error boundary
β”‚   └── not-found.tsx           # 404 page
β”‚
β”œβ”€β”€ components/                 # Shared UI components
β”‚   β”œβ”€β”€ roadmaps/               # Roadmap-specific components (RoadmapFlow, etc.)
β”‚   β”œβ”€β”€ navbar/                 # Navigation components
β”‚   β”œβ”€β”€ ui/                     # shadcn/ui primitives
β”‚   └── ...
β”‚
β”œβ”€β”€ lib/                        # Shared utilities and configuration
β”‚   β”œβ”€β”€ auth.ts                 # NextAuth configuration
β”‚   β”œβ”€β”€ auth-utils.ts           # requireAuth / requireAdmin helpers
β”‚   β”œβ”€β”€ api-handler.ts          # withErrorHandler wrapper + ApiError class
β”‚   β”œβ”€β”€ cache.ts                # In-memory / Redis cache abstraction
β”‚   β”œβ”€β”€ config.ts               # Central app config (pagination, TTLs, feature gates)
β”‚   β”œβ”€β”€ env.ts                  # Zod-validated environment variables
β”‚   β”œβ”€β”€ feature-gates.ts        # checkFeatureAccess + subscription tier logic
β”‚   β”œβ”€β”€ logger.ts               # Structured JSON logger
β”‚   └── prisma/
β”‚       β”œβ”€β”€ client.ts           # Prisma client singleton
β”‚       └── queries.ts          # All database query functions
β”‚
β”œβ”€β”€ features/                   # Feature barrel exports
β”‚   β”œβ”€β”€ auth/                   # Auth feature re-exports
β”‚   └── roadmaps/               # Roadmap feature re-exports
β”‚
β”œβ”€β”€ prisma/
β”‚   └── schema.prisma           # Database schema (MongoDB + Prisma)
β”‚
β”œβ”€β”€ scripts/
β”‚   └── seed-sample-data.ts     # Idempotent database seed script
β”‚
β”œβ”€β”€ tests/
β”‚   └── data-isolation.test.ts  # Integration tests for multi-user data isolation
β”‚
β”œβ”€β”€ types/
β”‚   └── index.ts                # Shared TypeScript types
β”‚
β”œβ”€β”€ middleware.ts               # NextAuth route protection middleware
β”œβ”€β”€ .env.example                # Environment variable template
└── .eslintrc.json              # ESLint configuration

Key Features

  • Authentication β€” Email/password + Google/GitHub OAuth via NextAuth
  • Roadmaps β€” Browse, filter, search, and track progress through learning roadmaps
  • Dashboard β€” Personal learning stats, weekly activity, in-progress and saved roadmaps
  • Admin Panel β€” Create and manage roadmaps, view real-time platform stats
  • Subscriptions β€” FREE/PRO/TEAM tier architecture with feature gating
  • Caching β€” In-memory cache (Redis-ready) for roadmap list and detail endpoints
  • Data Isolation β€” All user data (progress, bookmarks, likes) is scoped per user

Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/my-feature
  3. Commit your changes: git commit -m 'Add my feature'
  4. Push to the branch: git push origin feature/my-feature
  5. Open a pull request

See CONTRIBUTING.md for detailed guidelines.


License

MIT β€” see LICENSE for details.

Releases

No releases published

Packages

 
 
 

Contributors