examples

module
v0.0.0-...-8b33263 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: MIT

README

encore icon

Encore Templates
Templates to help you build backend applications with Encore.

Template types

This repo contains two types of templates:

  • Starters: Runnable Encore applications for others to use as is, or take inspiration from.
  • Bits: Re-usable code samples to solve common development patterns or integrate Encore applications with third-party APIs and services.

Prerequisite: Installing Encore

If this is the first time you're using Encore, you first need to install the CLI that runs the local development environment. Use the appropriate command for your system:

  • macOS: brew install encoredev/tap/encore
  • Linux: curl -L https://encore.dev/install.sh | bash
  • Windows: iwr https://encore.dev/install.ps1 | iex

Starters

Name Description Primitives Requirements
hello-world REST API Starter APIs -
sql-database PostgreSQL database Starter APIs, SQL Database Docker
slack-bot Slack Bot Starter APIs Slack Workspace
trello-clone Microservices Starter (Trello Clone) Microservices, APIs, SQL Database Docker
uptime Event-Driven Architecture Starter (Uptime Monitor) Microservices, SQL Databases, Pub/Sub, Cron Jobs Docker
graphql GraphQL Server Starter APIs, SQL Database, GraphQL Docker
url-shortener Basic url shortener APIs, SQL Database Docker
sqlc-database Simple sqlc implementation APIs, SQL Database sqlc, Docker
next-starter Next.js + Encore Web App Starter APIs, Auth, Frontend Node.js
next-auth0-starter Next.js + Auth0 + Encore Web App Starter APIs, Auth, Frontend Node.js
react-starter React + Encore Web App Starter APIs, Auth, Frontend Node.js
booking-system Appointment Booking System Starter using data scrubbing and sqlc APIs, Auth, SQL Database, Frontend Docker

Running Starters

Each sub-folder in this repo contains a runnable Starter application.

Use encore app create [app-name] --example=[folder-name] to create your own app based on the example.

For example, to create an app based on sql-database:

$ encore app create my-app --example=sql-database
Successfully created app my-app.
$ cd my-app
$ encore run
Running on http://localhost:4000
8:00AM INF registered endpoint endpoint=There service=hello

Bits

The bits sub-folder contains reusable code samples that can be copied directly into your own application.

Name Description Primitives Requirements
elevenlabs Getting text to speech from ElevenLabs generative voice AI APIs, Secrets ElevenLabs API key
pexels Searching and retrieving photos and videos from Pexels APIs, Secrets Pexels API key
sendgrid Asynchronous sending emails via SendGrid APIs, Secrets, Pub/Sub SendGrid API key

Contribute your templates

Contribute a template by submitting a Pull Request to the Open Source Examples Repo: https://github.com/encoredev/examples

Submitting Starters

Follow these steps to submit a Starter:

  1. Fork the repo.
  2. Create a new folder in the root directory of the repo, this is where you will place your template. Use a short folder name as your template will be installable via the CLI, like so: encore app create APP-NAME --example=<TEMPLATE_FOLDER_NAME>
  3. Include a README.md with instructions for how to use the template. We recommend following this format.

Once your Pull Request has been approved, it may be featured on the Templates page on the Encore website.

Submitting Bits

Follow these steps to submit your Bits:

  1. Fork the repo.
  2. Create a new folder inside the bits folder in the repo and place your template inside it. Use a short folder name as your template will soon be installable via the CLI.
  3. Include a README.md with instructions for how to use the template.

Once your Pull Request has been approved, it may be featured on the Templates page on the Encore website.

Dynamic Encore AppID

In most cases, you should avoid hardcoding an AppID in your template's source code. Instead, use the notation {{ENCORE_APP_ID}}.

When a developer creates an app using the template, {{ENCORE_APP_ID}} will be dymically replaced with their new and unique AppID, meaning they will not need to make any manual code adjustments.

Directories

Path Synopsis
bits
elevenlabs
Package elevenlabs is used for handling communication with generative voice AI from https://elevenlabs.io/
Package elevenlabs is used for handling communication with generative voice AI from https://elevenlabs.io/
pexels
Package pexels is used for searching and retrieving photos and videos from Pexels https://www.pexels.com/api/documentation/
Package pexels is used for searching and retrieving photos and videos from Pexels https://www.pexels.com/api/documentation/
hello-world module
sql-database module

Jump to

Keyboard shortcuts

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