This website is a demo project from the book Node.js Design Patterns (4th Edition) by Mario Casciaro and Luciano Mammino. The book is your guide to building scalable, reliable Node.js applications using proven patterns and real-world techniques.
👉 Visit the official website to learn more and download a free chapter to get started.
This is a sample events website built with Next.js, Prisma, and SQLite. It allows users to browse events, reserve spots, and manage their reservations.
You can run this application either locally or using Docker.
Follow these steps to run the application locally:
-
Clone the repository:
git clone https://github.com/lmammino/sample-events-website.git cd sample-events-website -
Install dependencies: Make sure you have
pnpminstalled. If not, install it globally:npm install -g pnpm
Then, install the project dependencies:
pnpm install
-
Generate Prisma client:
pnpm dlx prisma generate
-
Initialize the database: Run the following commands to set up the database:
pnpm dlx prisma migrate deploy pnpm dlx prisma db push node prisma/seed.ts
-
Set up environment variables: Create a
.envfile in the root of the project and add the following line:NEXTAUTH_URL=http://localhost:3000You can also set
NEXTAUTH_SECRETto a random string for local development. You can generate a random secret using the following command:openssl rand -base64 42
Alternatively, you can use the provided
.env.exampleas a template. -
Start the development server:
pnpm dev
The application will be available at http://localhost:3000.
To run the application using Docker, use the following command:
docker run -p 3000:3000 ghcr.io/lmammino/sample-events-website:mainThis will pull the pre-built Docker image from GitHub Container Registry and start the application. The application will be available at http://localhost:3000.
- Browse upcoming events
- Reserve spots for events
- View and manage your reservations
- Authentication and user management
The application uses the following environment variables:
NEXTAUTH_URL: The base URL of the application (default:http://localhost:3000)NEXTAUTH_SECRET: A secret key for NextAuth (generated dynamically in Docker or set manually for local development)
Feel free to open issues or submit pull requests to improve this project. Contributions are welcome!
This project is licensed under the MIT License.