starters

package
v0.1.0-beta Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Templates = map[string]Template{
	"fullstack-cloudbeaver": {
		Name:  "Full-Stack App with CloudBeaver",
		Desc:  "A complete full-stack application with CloudBeaver database management included",
		Stack: []string{"postgres", "cloudbeaver", "fullstack"},
		Files: map[string]string{
			"nexlayer.yaml": `application:
  name: my-nexlayer-app
  registryLogin:
    registry: ghcr.io
    username: Username
    personalAccessToken: personalAccessToken
  pods:
    - name: postgres
      image: postgres:16
      vars:
        POSTGRES_USER: postgres
        POSTGRES_PASSWORD: passw0rd
        POSTGRES_DB: postgres
        PGDATA: /var/lib/postgresql/data
      servicePorts:
        - 5432
      volumes:
        - name: pg-data-volume
          size: 2Gi
          mountPath: /var/lib/postgresql
    - name: cloudbeaver-postgres
      image: katieharris/cloudbeaver-postgres:v0.04
      vars:
        POSTGRES_USER: postgres
        POSTGRES_PASSWORD: passw0rd
        POSTGRES_DB: cloudbeaver
      servicePorts:
        - 5432
      volumes:
        - name: cb-pg-data-volume
          size: 2Gi
          mountPath: /var/lib/postgresql
    - name: cloudbeaver
      path: /cloudbeaver
      image: katieharris/cloudbeaver:v0.03
      vars:
        CLOUDBEAVER_DB_URL: jdbc:postgresql://cloudbeaver-postgres.pod:5432/cloudbeaver
        CLOUDBEAVER_DB_USER: postgres
        CLOUDBEAVER_DB_PASSWORD: passw0rd
        CLOUDBEAVER_ROOT_URI: /cloudbeaver
      servicePorts:
        - 8978
      volumes:
        - name: logs-volume
          size: 2Gi
          mountPath: /opt/cloudbeaver/logs
        - name: workspace-volume
          size: 2Gi
          mountPath: /opt/cloudbeaver/workspace
    - name: backend
      image: <% REGISTRY %>/username/project/backend:tag
      vars:
        DATABASE_URL: postgresql://postgres:passw0rd@postgres.pod:5432/postgres
      servicePorts:
        - 1234
    - name: frontend
      path: /
      image: <% REGISTRY %>/username/project/frontend:tag
      vars:
        BACKEND_URL: http://backend.pod:1234
      servicePorts:
        - 4321`,
			"README.md": `# Full-Stack Application with CloudBeaver

This is a complete full-stack application template that includes:
- PostgreSQL database
- CloudBeaver database management interface
- Backend service
- Frontend service

## Components

1. PostgreSQL (port 5432)
   - Main application database
   - Credentials: postgres/passw0rd

2. CloudBeaver PostgreSQL (port 5432)
   - Separate database for CloudBeaver
   - Credentials: postgres/passw0rd

3. CloudBeaver (port 8978)
   - Access at /cloudbeaver
   - Preconfigured for database access

4. Backend (port 1234)
   - Connected to PostgreSQL
   - Replace <% REGISTRY %>/username/project/backend:tag with your image

5. Frontend (port 4321)
   - Connected to backend
   - Replace <% REGISTRY %>/username/project/frontend:tag with your image

## Getting Started

1. Update the registryLogin section with your credentials
2. Replace the backend and frontend image placeholders
3. Deploy with: nexlayer deploy

## Volumes

The template includes persistent volumes for:
- PostgreSQL data (2Gi)
- CloudBeaver PostgreSQL data (2Gi)
- CloudBeaver logs (2Gi)
- CloudBeaver workspace (2Gi)

## Environment Variables

All necessary environment variables are preconfigured, including:
- Database connections
- CloudBeaver settings
- Service URLs`,
		},
	},
	"node-express": {
		Name:  "Node.js Express API",
		Desc:  "A simple Express.js API with TypeScript",
		Stack: []string{"node", "express", "typescript"},
		Files: map[string]string{
			"package.json": `{}`,
			"src/index.ts": `console.log("Hello");`,
		},
	},
	"python-fastapi": {
		Name:  "Python FastAPI",
		Desc:  "A modern Python API with FastAPI",
		Stack: []string{"python", "fastapi"},
		Files: map[string]string{
			"requirements.txt": `fastapi==0.95.1`,
			"main.py":          `print("Hello")`,
		},
	},
}

Templates is a map of template names to templates

Functions

func CreateProject

func CreateProject(projectName, templateName string) error

CreateProject creates a new project from a template

func GetTemplateItems

func GetTemplateItems() []list.Item

GetTemplateItems returns a list of template items for bubbletea

Types

type Template

type Template struct {
	Name  string            `json:"name"`
	Desc  string            `json:"description"`
	Files map[string]string `json:"files"`
	Stack []string          `json:"stack"`
}

Template represents a project starter template

type TemplateItem

type TemplateItem struct {
	Name string
	Desc string
}

TemplateItem implements list.Item for bubbletea

func (TemplateItem) Description

func (t TemplateItem) Description() string

func (TemplateItem) FilterValue

func (t TemplateItem) FilterValue() string

func (TemplateItem) Title

func (t TemplateItem) Title() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL