Thanks to visit codestin.com
Credit goes to github.com

Skip to content

endorhq/node-demo

Repository files navigation

Rocket Launch Countdown Admin 🚀

CI Endor Dev

A space-themed NodeJS demo application for managing rocket launch countdowns. Built with Fastify and Prisma, featuring a clean and simple interface for creating, viewing, and managing countdown timers for upcoming rocket launches.

It uses Endor to run a Postgres database for development. You do not need to install any additional software, as Endor is like any other Node dependency.

Features

  • ✅ Create and manage rocket launch countdowns
  • ✅ Live countdown timers with days, hours, minutes, and seconds
  • ✅ RESTful API for programmatic access
  • ✅ Simple, responsive web interface
  • ✅ No authentication required (simplified admin panel)
  • ✅ PostgreSQL database support via Prisma ORM

Tech Stack

  • Backend: Node.js with Fastify
  • Database: PostgreSQL with Prisma ORM. Run with Endor
  • Frontend: Plain HTML, CSS, and JavaScript (no frameworks)
  • Template Engine: EJS
  • Testing: Node.js built-in test runner

Prerequisites

  • Node.js 20+
  • npm

Installation

  1. Clone the repository:
git clone https://github.com/endorhq/node-demo.git
cd node-demo
  1. Install dependencies:
npm install
  1. Set up environment variables:
cp .env.example .env
  1. Generate Prisma client:
npm run db:generate
  1. Start the application and the database:
npm run dev
  1. Push database schema:
npm run db:push

Running the Application

Development mode (with auto-reload):

npm run dev

Production mode:

npm start

The application will be available at http://localhost:3000

API Documentation

Endpoints

GET /api/countdowns

Get all countdowns sorted by launch date.

Response:

[
  {
    "id": 1,
    "mission": "Artemis III",
    "rocket": "SLS Block 1B",
    "launchDate": "2025-12-01T14:00:00.000Z",
    "description": "First crewed lunar landing mission",
    "createdAt": "2025-01-11T10:00:00.000Z",
    "updatedAt": "2025-01-11T10:00:00.000Z"
  }
]

GET /api/countdowns/:id

Get a specific countdown by ID.

POST /api/countdowns

Create a new countdown.

Request body:

{
  "mission": "Mission Name",
  "rocket": "Rocket Type",
  "launchDate": "2025-12-01T14:00:00Z",
  "description": "Optional mission description"
}

PUT /api/countdowns/:id

Update an existing countdown.

DELETE /api/countdowns/:id

Delete a countdown.

Testing

Run the test suite:

npm test              # Run all tests
npm run test:unit     # Run unit tests only
npm run test:integration  # Run integration tests only

Continuous Integration

This project includes GitHub Actions workflows for automated testing:

  • CI Pipeline: Runs on every push and pull request
    • Tests on Node.js 20.x and 22.x
    • Uses Endor to spin up PostgreSQL for integration tests
    • Includes unit tests, integration tests, and code quality checks
    • Falls back to containerized PostgreSQL if Endor fails

The CI configuration can be found in .github/workflows/ci.yml.

Database Schema

You can find it on the prisma/schema.prisma file.

License

MIT

About

Demo using Endor to run services as Node dependencies

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published