- ✨ 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!
Hackathon Backend is a scalable API built with NestJS for managing hackathons. It offers user authentication, hackathon CRUD operations, project submissions with file uploads, asynchronous processing, and email notifications, all secured with modern technologies.
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.
-
NestJS is a progressive Node.js framework for building efficient, reliable, and scalable server-side applications. It leverages TypeScript and combines elements of OOP (Object Oriented Programming), FP (Functional Programming), and FRP (Functional Reactive Programming) to provide a modular and highly testable architecture.
-
Prisma is a next-generation ORM (Object-Relational Mapping) for TypeScript and Node.js. It features an intuitive data model, automated migrations, type-safety, and auto-completion, allowing developers to read and write data to databases with minimal boilerplate.
-
PostgreSQL is an advanced, open-source relational database management system. Known for its reliability, feature robustness, and performance, it supports both SQL and JSON querying, making it ideal for handling complex data workloads.
-
Better Auth is a complete, open-source authentication and authorization solution. It provides a framework-agnostic approach to integrating secure user sessions, social sign-ons, and multi-factor authentication with deep TypeScript type-safety.
-
BullMQ is a premium message queue and batch processing library for Node.js based on Redis. It helps handle distributed jobs, delayed tasks, and high-concurrency background processing with strong atomicity and durability.
-
Arcjet is an advanced security layer for applications that helps developers protect their code against malicious attacks. It integrates directly into the application code to handle rate limiting, bot protection, email verification, and sensitive data masking.
-
Nodemailer is a popular module for Node.js applications that allows for easy email sending. It supports secure connections (TLS/STARTTLS), HTML content, attachments, and various transport methods, including SMTP, Amazon SES, and Sendmail.
🔐 Authentication (/api/auth): User registration, login, and role-based access control with secure session management and TypeScript type-safety.
🏆 Hackathon Management (/hackathon): Complete CRUD operations for hackathons, team formations, and streamlined participant registration.
📁 Project Submissions (/submission): Dedicated file upload support with resilient, asynchronous background processing powered by BullMQ.
📧 Email Notifications: Automated, transactional email systems for real-time updates on hackathon events, status changes, and successful submissions.
🛡️ Security: Native Arcjet integration to protect your application from malicious threats, bots, and brute-force attacks with intelligent rate limiting.
And many more, including code architecture and reusability.
Follow these steps to set up the project locally on your machine.
Make sure you have the following installed on your machine:
- Node.js (v18 or higher)
- npm or Yarn
- PostgreSQL database
- Redis instance
Clone the repository:
git clone https://github.com/JavaScript-Mastery-Pro/Hackathon-backend.git
cd Hackathon-backendInstall dependencies:
npm installSet up the database:
npm run db:migrateGenerate Prisma client:
npm run db:generateStart the development server:
npm run start:devCreate a new file named .env in the root of your project and add the following content:
PORT=8080
BACKEND_URL="http://localhost:8080"
FRONTEND_URL="http://localhost:3000"
AUTH_SECRET="your-auth-secret-here"
DATABASE_URL="your-postgresql-database-url"
REDIS_URL="your-redis-url"
SMTP_HOST="smtp.gmail.com"
SMTP_PORT=587
SMTP_USERNAME="your-email@gmail.com"
SMTP_PASSWORD="your-app-password"
ARCJET_ENV=development
ARCJET_KEY=your-arcjet-keyReplace the placeholder values with your real credentials. You can get these by signing up or generating secrets at: Better Auth, Arcjet, and your database providers.
Assets and snippets used in the project can be found in the video kit.
Advance your skills with our 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!