Skip to content

mbakgun/n8n-template-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

n8n Template Server

n8n Template Server hero banner

An opinionated companion service for hosting, curating, and distributing production-ready n8n automation templates. Built with Bun, Prisma, and PostgreSQL so your teams can publish reusable workflows with confidence.

Bun TypeScript Prisma PostgreSQL

Table of contents

Overview

The n8n Template Server exposes a catalog of curated workflow templates that can be consumed by the n8n editor or any internal catalog experience. It provides a secure API layer for searching, browsing, and retrieving workflow blueprints while persisting templates and metadata in PostgreSQL via Prisma.

Use it to:

  • Operate a central source of truth for automation templates.
  • Share best-practice workflows across teams and business units.
  • Curate collections for onboarding, demos, and production use cases.

Features

  • Search-first workflow discovery: Filter templates by name, tags, and categories to accelerate adoption.
  • Collection management: Group workflows into curated collections for campaigns, verticals, or onboarding journeys.
  • Preview-ready JSON payloads: Serve the exact workflow definition required by the n8n editor without additional transforms.
  • Secure health monitoring: Built-in health endpoint for observability and load balancer checks.
  • Bun-powered performance: Lightweight runtime with instant dev reloads and native TypeScript support.
  • Modern Admin Interface: Beautiful, responsive admin UI built with Tailwind CSS for managing templates efficiently.

Admin Interface

The admin interface provides a modern, user-friendly dashboard for managing n8n templates. Access it at /admin after starting the server.

Main Dashboard

Admin Dashboard

The main dashboard displays all templates in a responsive grid layout with search and category filtering capabilities.

Create/Edit Template Modal

Create Template Modal

Create new templates or edit existing ones through an intuitive modal interface with JSON workflow editor.

Authentication

Authentication Modal

Secure authentication system with persistent login using localStorage.

Bulk Import

Bulk Import Modal

Import multiple templates at once using JSON file upload.

Key Features

  • Search & Filter: Quickly find templates by name or filter by category
  • Responsive Design: Works seamlessly on desktop, tablet, and mobile devices
  • Real-time Updates: Instant feedback with toast notifications
  • Category Management: Automatic category creation and management
  • Template Cards: Visual cards with hover effects and category badges

Architecture overview

Template distribution architecture diagram

Layer Responsibilities
API Express server exposing REST endpoints and OpenAPI spec.
Controllers Business logic for workflows, collections, and categories.
Database PostgreSQL accessed through Prisma client and migrations.
Middleware Request validation, error handling, and auth guard.
Utilities Shared helpers for pagination, filtering, and formatting.

The service provides an API-first layer between content editors and the n8n runtime. Templates are ingested through the admin interface or bulk import scripts, validated via Prisma, and stored in PostgreSQL. Client applications (including the official n8n editor) fetch template metadata and workflow JSON through the REST endpoints.

Quick start

Choose the workflow that suits your environment.

Docker Compose

docker compose up --build

The service boots on port 3000 and automatically runs Prisma migrations against the bundled PostgreSQL container.

Local development with Bun

bun install
bunx prisma generate
bun --hot run src/server.ts

The hot-reload development server listens on http://localhost:3000.

Configuration

Set environment variables or mount a .local/secrets.json file. The values below mirror docker-compose.yml defaults.

Variable Description Default
NODE_ENV Runtime mode production
PORT HTTP port for the Bun server 3000
DB_HOST PostgreSQL hostname postgres
DB_PORT PostgreSQL port 5432
DB_NAME Database name n8n_templates
DB_USER Database user n8n_user
DB_PASSWORD Database password secure_password

Project structure

docker compose up --build
├── prisma
├── src
│   ├── controllers
│   ├── database
│   ├── middleware
│   ├── routes
│   └── utils
└── docs
  • prisma: schema and migrations for PostgreSQL.
  • src/controllers: request handlers for templates, collections, and categories.
  • src/database: Prisma client configuration and connection helpers.
  • src/middleware: shared Express middleware for auth and errors.
  • src/routes: REST route definitions.
  • src/utils: helper modules for pagination and formatting.
  • docs: visual assets and supplementary documentation.

API surface

Method Endpoint Description
GET /templates/workflows/:id Retrieve a single workflow template by ID.
GET /templates/search Search workflows by name, tags, or categories.
GET /templates/collections/:id Fetch a curated collection with its workflows.
GET /templates/collections List all available collections.
GET /templates/categories Return the list of categories.
GET /health Health check endpoint for uptime monitoring.

Development workflow

  1. Install dependencies with bun install.
  2. Generate the Prisma client with bunx prisma generate.
  3. Run bun --hot run src/server.ts for live reload during development.
  4. Execute bunx prisma migrate dev whenever you change the Prisma schema.

Database migrations

Prisma migrations live in the prisma/migrations directory. Use the following commands to manage schema changes:

bunx prisma migrate dev --name <migration-name>
bunx prisma migrate deploy
bunx prisma db seed

Troubleshooting

  • Confirm PostgreSQL is reachable and credentials match your environment variables.
  • Ensure Prisma migrations have been applied before starting the API.
  • Use GET /health to verify that the service and database connection are healthy.

License

MIT License

Copyright (c) 2025 Mehmet Burak Akgün

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Production-ready n8n workflow template catalog – secure, searchable, and API-first. Powered by Bun, Prisma, TypeScript, and PostgreSQL for instant n8n automation template sharing

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors