Skip to content

Local Setup

Prerequisites

Generated applications come with a fully configured and configurable local development environment. To get started, you will need to install Docker.

If you haven't generated an app yet, you can use our demo app to get familiar with the environment. You can always build your own app using our open source app base, but to unlock the full power of codecannon, you should generate your own app on app.codecannon.dev.

If you're unsure how to do this, please refer to the Getting Started guide.

First time setup

  1. Clone the repository
bash
# Replace github repo URL with your own upon code delivery
git clone https://github.com/codecannon/demo-app.git
  1. Copy the local example .env file
bash
cp .env.example .env
cp api/.env.example api/.env
cp ui/.env ui/.env.local
  1. Configure UID/GID (optional but recommended)

To avoid file permission issues when Docker containers create files on your host system, you should configure your user ID (UID) and group ID (GID) in the .env file. This ensures that files created inside containers are owned by your host user.

You can automatically set these values by running:

bash
./setup-uid-gid.sh

Or manually add them to your .env file:

bash
# Get your UID and GID
id -u  # Your UID
id -g  # Your GID

# Add to .env file
HOST_UID=1000
HOST_GID=1000

If you don't set these values, Docker will use the default user IDs from the container, which may cause permission issues when accessing files created by the containers.

  1. Start the local environment
bash
docker compose up

Configuring local environment

You can change your settings in the .env file in the root of the repository (.env.example).

Changing the application host

You can change the application host (URL) by changing the APP_URL variable in the .env file. This will change the URL at which the application is accessible.

sh
# APP_URL: Application URL (both frontend and backend).
# URL should be without trailing slash, and wihtout http/https prefix.
# Example: localhost
APP_URL=localhost

Changing the application port

You can change the application port by changing the APP_PORT variable in the .env file. This will change the port at which the application is accessible.

sh
# APP_URL: Application port (both frontend and backend).
# Should be a valid port number.
# Example: 80
APP_PORT=80

See also: