Skip to content

Latest commit

 

History

143 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Next.js 15 Admin Dashboard Template
Built with the Next.js App Router

Overview

This is a starter template using the following stack:

This template uses the new Next.js App Router. This includes support for enhanced layouts, colocation of components, tests, and styles, component-level data fetching, and more.

Getting Started

During the deployment, Vercel will prompt you to create a new Postgres database. This will add the necessary environment variables to your project.

Inside the Vercel Postgres dashboard, create a table based on the schema defined in this repository.

CREATE TYPE status AS ENUM ('active', 'inactive', 'archived');

CREATE TABLE products (
  id SERIAL PRIMARY KEY,
  image_url TEXT NOT NULL,
  name TEXT NOT NULL,
  status status NOT NULL,
  price NUMERIC(10, 2) NOT NULL,
  stock INTEGER NOT NULL,
  available_at TIMESTAMP NOT NULL
);

Then, uncomment app/api/seed.ts and hit http://localhost:3000/api/seed to seed the database with products.

Next, copy the .env.example file to .env and update the values. Follow the instructions in the .env.example file to set up your GitHub OAuth application.

npm i -g vercel
vercel link
vercel env pull

Finally, run the following commands to start the development server:

pnpm install
pnpm dev

You should now be able to access the application at http://localhost:3000.

Running GitHub Actions Locally

This project uses act to run GitHub Actions locally in Docker containers, providing an identical environment to GitHub's runners.

Prerequisites

  1. Install act:

    # macOS
    brew install act
    
    # Or install manually
    curl https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash
  2. Ensure Docker is running:

    docker info

    If Docker isn't running, start Docker Desktop.

Configuration

The project includes pre-configured files:

  • .actrc - Docker image configuration for Ubuntu runners
  • .secrets - Environment variables for local testing (GitHub secrets)

Usage

List available workflows:

act --list

Run the PR tests workflow (recommended):

act pull_request --container-architecture linux/amd64 --job build-test

Run with dry-run to see what would execute:

act pull_request --container-architecture linux/amd64 --job build-test --dryrun

Run specific workflow events:

# Simulate pull request
act pull_request

# Simulate push to main
act push

What Gets Tested

The local GitHub Actions workflow runs:

  1. PostgreSQL Service - Spins up a containerized Postgres database
  2. Code Checkout - Uses your local repository
  3. pnpm Installation - Installs dependencies with caching
  4. Node.js Setup - Configures Node.js 20 with package manager caching
  5. Environment Setup - Creates test environment with database connection
  6. Linting - Runs ESLint checks
  7. Testing - Executes all Jest tests (98 tests across 9 suites)
  8. Building - Creates optimized production build

Benefits

  • 🔄 Identical Environment - Same containers and steps as GitHub Actions
  • 🚀 Fast Feedback - Test changes before pushing to GitHub
  • 🔒 Isolated Database - Uses containerized PostgreSQL instead of production
  • 💰 Cost Effective - No GitHub Actions minutes consumed for testing
  • 🐛 Debug Locally - Easier to troubleshoot CI issues

Troubleshooting

Docker socket issues on macOS:

# Ensure Docker Desktop is running
open -a Docker

# Check Docker status
docker info

Permission issues:

# Make sure your user is in the docker group
sudo usermod -aG docker $USER

Cache issues:

# Clear act cache if needed
act --rm

Releases

Packages

Used by

Contributors

Languages