Skip to content

Starter Templates Reference

Complete reference for Airbase starter templates

Starter templates provide pre-configured project structures that help you quickly build and deploy applications on Airbase. Each template includes all necessary configuration files, dependencies, and example code to get you started.


Overview

Templates are quick and easy ways to get started building an application on Airbase. Whether it's prototyping an idea, building a proof-of-concept, or laying the foundation for the next big thing, there's a template for you.

What's included in templates: - Pre-configured airbase.json with recommended settings - Production-ready Dockerfile using Airbase base images - .dockerignore and .gitignore files - Example application code demonstrating best practices - Environment variable configuration examples - README with setup instructions


Available Templates

Full-Stack Templates

airbase-t3-app (Next.js)

Type: Full-Stack Web Application

Stack: - Framework: Next.js (React) - Language: TypeScript - Database: PostgreSQL (via Prisma ORM) - Authentication: NextAuth.js - Styling: Tailwind CSS - API: tRPC (type-safe API layer)

Use cases: - Full-stack web applications - Dashboards and admin panels - User-facing web apps with authentication - Apps requiring SSR (Server-Side Rendering)

Link: SGTS GitLab - airbase-t3-app

Instance type: Recommended b.small

Prerequisites: - Node.js 22+ - PostgreSQL database (external)


airbase-streamlit-app (Python)

Type: Data Application / Dashboard

Stack: - Framework: Streamlit - Language: Python 3.13 - Data: Pandas, NumPy - Visualization: Plotly, Matplotlib

Use cases: - Data dashboards and visualizations - Internal tools for data analysis - Machine learning model demos - Quick prototypes for data exploration

Link: SGTS GitLab - airbase-streamlit-app

Instance type: Recommended b.small

Prerequisites: - Python 3.13+

Notes: - Streamlit apps typically require at least b.small due to memory requirements - Keep datasets small (<100MB) for optimal performance


Backend API Templates

airbase-go-app (Go)

Type: Backend REST API

Stack: - Language: Go (Golang) 1.25 - Router: Chi router or Gin (varies by template version) - API Style: RESTful

Use cases: - High-performance REST APIs - Microservices - Backend services for mobile/web apps - System utilities and tools

Link: SGTS GitLab - airbase-go-app

Instance type: Recommended nano to b.small

Prerequisites: - Go 1.25+

Notes: - Go applications typically have lower memory footprint - nano instance may be sufficient for simple APIs


Using a Template

Quick Start

  1. Clone the template repository:

    git clone <template-url>
    cd <template-name>
    

  2. Install dependencies:

  3. Node.js: npm install
  4. Python: pip install -r requirements.txt
  5. Go: go mod download

  6. Configure for your project:

  7. Update airbase.json with your project handle
  8. Set environment variables in .env
  9. Update README with your project details

  10. Test locally:

  11. Node.js: npm run dev
  12. Python: streamlit run app.py
  13. Go: go run main.go

  14. Build and deploy:

    airbase container build
    airbase container deploy --yes staging
    

Customizing Templates

Rename project: - Update airbase.jsonhandle - Update package.jsonname (Node.js) - Update README title

Adjust instance type:

{
  "framework": "container",
  "handle": "team/project",
  "port": 3000,
  "instanceType": "b.small"
}

Add dependencies: - Node.js: npm install <package> - Python: Add to requirements.txt, run pip install -r requirements.txt - Go: go get <package>, run go mod tidy


Template Structure

Standard Template Contents

All templates follow this basic structure:

template-name/
├── airbase.json          # Airbase configuration
├── Dockerfile            # Container build instructions
├── .dockerignore         # Files to exclude from Docker build
├── .gitignore            # Files to exclude from Git
├── .env.example          # Environment variable template
├── README.md             # Setup and usage instructions
├── package.json          # Dependencies (Node.js)
├── requirements.txt      # Dependencies (Python)
├── go.mod                # Dependencies (Go)
└── src/                  # Application source code

Required Files

Every template must include:

  1. airbase.json - Airbase project configuration

    {
      "framework": "container",
      "handle": "namespace/project-name",
      "port": 3000,
      "instanceType": "b.small"
    }
    

  2. Dockerfile - Using Airbase base images

    FROM gdssingapore/airbase:node-22
    WORKDIR /app
    COPY --chown=app:app . ./
    USER app
    EXPOSE 3000
    CMD ["npm", "start"]
    

  3. .dockerignore - Exclude unnecessary files

    node_modules
    .git
    .env*
    

  4. README.md - Setup instructions and documentation

  • .env.example - Example environment variables
  • .gitignore - Files to exclude from version control
  • docker-compose.yml - Local development setup
  • Tests directory with example tests

Template Categories

By Application Type

Category Templates Use Cases
Full-Stack Web airbase-t3-app User-facing web apps, dashboards, admin panels
Data & Analytics airbase-streamlit-app Data dashboards, ML demos, internal tools
Backend API airbase-go-app REST APIs, microservices, backend services
Static Sites (use Figma Make) Landing pages, marketing sites, documentation

By Technology Stack

Stack Templates
Node.js/TypeScript airbase-t3-app
Python airbase-streamlit-app
Go airbase-go-app

By Instance Type Requirement

Instance Type Suitable Templates
nano airbase-go-app (simple APIs)
b.small airbase-t3-app, airbase-streamlit-app, airbase-go-app (standard apps)

Making Your Own Template

Can't find something that catches your eye? Feel free to create your own template from scratch.

Template Requirements

To create a shareable Airbase template:

  1. Include all required files (airbase.json, Dockerfile, .dockerignore, README.md)

  2. Use Airbase base images in Dockerfile:

    FROM gdssingapore/airbase:node-22
    # or
    FROM gdssingapore/airbase:python-3.13
    # or
    FROM gdssingapore/airbase:golang-1.25
    

  3. Follow security best practices:

  4. Set USER app in Dockerfile
  5. Use --chown=app:app in COPY commands
  6. Don't commit secrets or .env files

  7. Provide clear documentation:

  8. Prerequisites
  9. Local development setup
  10. Deployment instructions
  11. Environment variables needed

  12. Include example code:

  13. Health check endpoint (/health)
  14. Example API routes or pages
  15. Environment variable usage
  16. Error handling patterns

Example Template Structure

Minimal working template:

my-template/
├── airbase.json
├── Dockerfile
├── .dockerignore
├── .env.example
├── .gitignore
├── README.md
└── src/
    └── index.js

README.md should include:

# My Template

## Description
Brief description of what this template provides.

## Prerequisites
- Node.js 22+
- Docker

## Local Development
\```bash
npm install
npm run dev
\```

## Deployment
\```bash
airbase container build
airbase container deploy --yes staging
\```

## Environment Variables
See .env.example for required variables.

Contributing Templates

If you'd like to contribute your template to the official Airbase template collection:

  1. Test thoroughly on Airbase staging environment
  2. Ensure all documentation is complete
  3. Submit feedback with template link: go.gov.sg/airbase-feedback
  4. Include:
  5. Template name and description
  6. Use cases and target audience
  7. Link to GitLab repository
  8. Recommended instance type

Review criteria: - Follows Airbase best practices - Complete documentation - Uses Airbase base images - Includes working example code - Secure by default (no hardcoded secrets)


Template Maintenance

Updating Dependencies

Node.js templates:

# Check for outdated packages
npm outdated

# Update to latest compatible versions
npm update

# Update to latest versions (breaking changes possible)
npm install <package>@latest

Python templates:

# Check for outdated packages
pip list --outdated

# Update specific package
pip install --upgrade <package>

# Update requirements.txt
pip freeze > requirements.txt

Go templates:

# Update dependencies
go get -u ./...
go mod tidy

Updating Base Images

When Airbase releases new base image versions:

  1. Update Dockerfile:

    # Before
    FROM gdssingapore/airbase:node-22
    
    # After
    FROM gdssingapore/airbase:node-24
    

  2. Test locally:

    airbase container build
    airbase container deploy --yes staging
    

  3. Verify application works correctly

  4. Update documentation if needed


Troubleshooting Templates

Build Fails

Problem: Docker build fails with "file not found"

Solution: - Check .dockerignore is not excluding required files - Verify all files referenced in Dockerfile exist - Ensure COPY paths are correct

Application Won't Start

Problem: Container exits immediately after deployment

Solution: - Check logs in Airbase Console for staging environment - Verify CMD in Dockerfile is correct - Ensure all dependencies are installed in Dockerfile - Check for missing environment variables

Port Binding Issues

Problem: Application not accessible via URL

Solution: - Ensure application binds to process.env.PORT (Node.js) or os.environ.get('PORT') (Python) - Verify EXPOSE port in Dockerfile matches - Check application logs for binding errors


See Also