Run it your way: Deploy Thin on your own infrastructure in less than 5 minutes.
Running Thin locally requires docker to be installed. If you haven't installed docker yet, follow the install instructions on the docker website before you continue.
Create a new file docker-compose.yml
:
services:
db:
image: postgres:alpine3.16
restart: always
environment:
POSTGRES_PASSWORD: examplepassword
ports:
- '5432:5432'
thin:
image: downloads.digitallyinduced.com/digitallyinduced/thin-backend:latest
restart: always
ports:
- 8000:8000
depends_on:
- db
environment:
DATABASE_URL: "postgres://postgres:examplepassword@db/postgres"
TYPE_DEFINITONS_BASE_PATH: "$PWD"
volumes:
- ".:/home/app/Application:rw"
Now you can start the database and Thin Backend with docker-compose:
docker compose up
On first start Thin will automatically generate a few files in the working directory:
File | Description |
---|---|
Schema.sql | Database tables are defined here. You can edit this file with your text editor if you want. |
Migration/ | Database migrations are stored here. |
Types/ | npm package that contains the generated TypeScript definitions. |
jwt.pub | Public key generated for the JWT-based |
jwt.secret | Secret key generated for the JWT-based. Keep this secret. |
It's recommended to keep all these files (except the Types/
directory) in git.
The self hosted Thin works very similiar to the Cloud version at thin.dev, so you can follow all the other Guides and it should just work as expected. Make sure to use http://localhost:8000
as your Backend url.
If you need any help or input, feel free to ask in the Thin Community Forum.