π Table of Contents
- β¨ Introduction
- βοΈ Tech Stack
- π Features
- π€Έ Quick Start
- π Assets
- π More
This repository contains the code corresponding to an in-depth tutorial available on our YouTube channel, JavaScript Mastery.
If you prefer visual learning, this is the perfect resource for you. Follow our tutorial to learn how to build projects like these step-by-step in a beginner-friendly manner!
A high-performance PERN stack (PostgreSQL, Express, React, Node.js) academic hub. This multi-role system (Admin, Teacher, Student) utilizes a decoupled architecture where an Express/Node.js backend serves a modular React frontend powered by Refine. By leveraging PostgreSQL (Neon) with Drizzle ORM, it ensures type-safe data integrity for class management, automated scheduling, and real-time analytics. Secure access is managed via Better-Auth, providing a robust, controlled-access environment for campus operations.
If you're getting started and need assistance or face any bugs, join our active Discord community with over 50k+ members. It's a place where people help each other out.
-
React is a declarative, component-based JavaScript library for building user interfaces. It allows for the creation of complex, interactive UIs through reusable components, providing the core frontend experience for the academic hub.
-
Refine is a React-based framework for building data-intensive applications like admin panels and dashboards. It provides a headless approach that handles core logicβsuch as authentication, routing, and data fetchingβallowing developers to focus on the UI and business logic.
-
shadcn/ui is a collection of re-usable components built using Radix UI and Tailwind CSS. It allows developers to build high-quality, accessible design systems by providing beautifully designed components that can be copied and pasted directly into applications.
-
Tailwind CSS is a utility-first CSS framework for rapidly building custom user interfaces. It provides low-level utility classes that let you build completely custom designs without ever leaving your HTML, ensuring highly maintainable and responsive styling.
-
TypeScript is a superset of JavaScript that adds static typing, providing better tooling, code quality, and error detection for developers. It is ideal for building large-scale applications and enhances the development experience.
-
Zod is a TypeScript-first schema declaration and validation library. It is used to define data structures and validate them at runtime, ensuring type safety and reducing bugs by providing a single source of truth for both static types and data validation.
-
Arcjet is a security-first tool that helps developers protect their applications with just a few lines of code. It provides security primitives for rate limiting, bot protection, email validation, and sensitive data masking, ensuring the application remains secure and resilient.
-
Better Auth is a framework-agnostic authentication and authorization library for TypeScript. It provides built-in support for email and password authentication, social sign-on (Google, GitHub, Apple, and more), and multi-factor authentication, simplifying user authentication and account management.
-
Cloudinary is an end-to-end image and video management solution. It automates the upload, storage, manipulation, and delivery of media assets, ensuring optimized performance and a seamless visual experience across any device.
-
Drizzle ORM is a lightweight and performant TypeScript ORM designed with developer experience in mind. It provides a seamless interface between application code and database operations while maintaining high performance and reliability.
-
Express.js is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications. It facilitates the rapid development of RESTful APIs and serves as the standard server framework for the Node.js ecosystem.
-
Neon is a fully managed, serverless PostgreSQL database platform. It offers features like instant provisioning, autoscaling, and database branching, enabling developers to build scalable applications without managing infrastructure.
-
Node.js is an open-source, cross-platform JavaScript runtime environment that executes JavaScript code outside a web browser. It is designed to build scalable network applications and serves as the foundation for the project's backend logic.
-
CodeRabbit is an AI-powered code review platform that provides automated, contextual feedback on pull requests. It helps developers improve code quality and catch potential bugs early by integrating directly into the development workflow.
-
Site24x7 is a comprehensive monitoring solution that provides deep insights into application performance and infrastructure health. It allows for real-time tracking of uptime, end-user experience, and server metrics to ensure maximum availability.
π Multi-Role Authentication: A secure entry system powered by Better Auth and Arcjet that dynamically routes Students, Teachers, and Admins to protected dashboards with strict role-based permissions.
π Unified Analytics Dashboard: A high-level overview of the institution's health, featuring real-time statistics on student enrollment, active classes, and faculty distribution via Refine's data providers.
π Intelligent Subject Management: Centralized control for curriculum where you can create subjects, apply instant filters, and drill down into specific class assignments and teacher workloads.
π Departmental Governance: A structural management layer that organizes subjects and faculties into departments, providing detailed views of every student and educator within a specific academic branch.
π Dynamic Faculty Directory: A robust, paginated directory of all professors featuring advanced search by name or email, profile image hosting via Cloudinary, and full teaching schedule visibility.
π Advanced Class Orchestration: The core engine of the app built with Drizzle ORM, allowing Admins to schedule sessions, set capacity limits, and manage complex assignments of multiple teachers across different sections.
π Code-Based Enrollment System: A "Google Classroom" inspired workflow where students gain instant access to courses by entering a unique 6-8 digit joining code, ensuring a secure and controlled-access environment.
And many more, including code architecture and reusability.
Follow these steps to set up the project locally on your machine.
Prerequisites
Make sure you have the following installed on your machine:
Cloning the Repository
git clone https://github.com/JavaScript-Mastery-Pro/classroom-backend.git
cd classroom-backendInstallation
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:
# Database
DATABASE_URL=''
# Arcjet
ARCJET_KEY=
ARCJET_ENV=development
# Application
FRONTEND_URL="http://localhost:5173"
# Better Auth
BETTER_AUTH_SECRET=Replace the placeholder values with your real credentials. You can get these by signing up at: Arcjet, Neon, Better-Auth.
Running the Project
npm run devOpen http://localhost:8000 in your browser to view the project.
Assets and snippets used in the project can be found in the video kit.
Advance your skills with Next.js Pro Course
Enjoyed creating this project? Dive deeper into our PRO courses for a richer learning adventure. They're packed with detailed explanations, cool features, and exercises to boost your skills. Give it a go!