diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 67a8e3ece..4f49f0e7e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -151,3 +151,63 @@ curl -sSL "https://github.com/buildpacks/pack/releases/download/v0.32.1/pack-v0. - Once your pull request is merged, you will be automatically added as a contributor to the project. Thank you for your contribution! + + + + + +## Templates + +To add a new template, go to `templates` folder and create a new folder with the name of the template. + +Let's take the example of `plausible` template. + +1. create a folder in `templates/plausible` +2. create a `docker-compose.yml` file inside the folder with the content of compose. +3. create a `index.ts` file inside the folder with the following code as base: + +```typescript +import { + generateHash, + generateRandomDomain, + type Template, + type Schema, +} from "../utils"; + + +export function generate(schema: Schema): Template { + // do your stuff here, like create a new domain, generate random passwords, mounts. + +} +``` + +4. Now you need to add the information about the template to the `templates/templates.ts` is a object with the following properties: + +**Make sure the id of the template is the same as the folder name and don't have any spaces, only slugified names and lowercase.** + +```typescript +{ + id: "plausible", + name: "Plausible", + version: "v2.1.0", + description: + "Plausible is a open source, self-hosted web analytics platform that lets you track website traffic and user behavior.", + logo: "plausible.svg", // we defined the name and the extension of the logo + links: { + github: "https://github.com/plausible/plausible", + website: "https://plausible.io/", + docs: "https://plausible.io/docs", + }, + tags: ["analytics"], + load: () => import("./plausible/index").then((m) => m.generate), +}, +``` + +5. Add the logo or image of the template to `public/templates/plausible.svg` + + +### Recomendations +- Use the same name of the folder as the id of the template. +- The logo should be in the public folder. +- Test first on a vps or a server to make sure the template works. +