This guide will help you set up Activity.next using SQLite as your database backend. SQLite is a great choice for development environments or small instances with limited traffic.
- Node.js 24 and Yarn (v4.12.0 via Corepack)
- Git (to clone the repository)
- Set the
ACTIVITIES_DATABASEenvironment variable with the following JSON configuration (stringify it first):
{
"type": "sql",
"client": "better-sqlite3",
"useNullAsDefault": true,
"connection": {
"filename": "./dev.sqlite3"
}
}You can also add this configuration to a config.json file in the root directory:
{
"database": {
"type": "sql",
"client": "better-sqlite3",
"useNullAsDefault": true,
"connection": {
"filename": "./dev.sqlite3"
}
}
}- Run database migrations to set up the schema:
yarn migrateThis will execute all migration scripts in the migrations directory.
- Clone the repository:
git clone https://github.com/llun/activities.next.git
cd activities.next- Enable Corepack and install dependencies:
corepack enable
yarn install- Configure the environment (in addition to database settings above):
Create a config.json file with the following content:
{
"host": "your-domain.tld",
"secretPhase": "your-random-secret-for-sessions",
"allowEmails": ["your-email@example.com"],
"database": {
"type": "sql",
"client": "better-sqlite3",
"useNullAsDefault": true,
"connection": {
"filename": "./dev.sqlite3"
}
}
}- Run migrations and start the development server:
yarn migrate
yarn devTo run Activity.next locally and communicate with other federated servers, you'll need a tunnel service that exposes your local server to the internet:
- Set up a tunnel service like Cloudflare Tunnel or ngrok
- Point the tunnel to localhost:3000
- Use your tunnel's domain as the
hostin your configuration
For production deployment with SQLite:
- Make sure to place your SQLite database in a persistent directory
- Consider using a more robust file locking mechanism
- Implement regular database backups
Remember that SQLite is best suited for low to moderate traffic instances. For higher traffic or multi-server deployments, consider using PostgreSQL instead.
To deploy Activity.next with SQLite using Docker:
docker run -p 3000:3000 \
-e ACTIVITIES_HOST=your.domain.tld \
-e ACTIVITIES_SECRET_PHASE=random-secret-for-cookie \
-e ACTIVITIES_DATABASE_CLIENT=better-sqlite3 \
-e ACTIVITIES_DATABASE_SQLITE_FILENAME=/opt/activities.next/data.sqlite \
-v /path/to/local/storage:/opt/activities.next \
ghcr.io/llun/activities.next:latestThe -v option mounts a local directory to the container's /opt/activities.next directory, which allows the SQLite database to persist between container restarts. Make sure to create this directory with appropriate permissions beforehand.