Positive.help is a place where people share positivity. Currently, the ability to add new messages is invite-only, and user registration and sign up are managed through Clerk. Our database is with Turso.
- Node.js (version 18 or later)
- pnpm
- Turso database credentials (URL and authentication token)
- Clerk API keys (e.g.,
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY,CLERK_SECRET_KEY)
- Clone the repository:
git clone <repository_url>
cd positivehelp- Install dependencies:
pnpm install- Create a
.envfile in the root directory (you can use a provided.env.exampleas a reference if it exists) and add your environment variables for Turso and Clerk. Important: UseNEXT_PUBLIC_prefix for Clerk's publishable key so it's available in the browser. For example:
DATABASE_URL="libsql://<your-database-url>"
DATABASE_AUTH_TOKEN="<your-auth-token>"
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY="your_clerk_publishable_key"
CLERK_SECRET_KEY="your_clerk_secret_key"- Start the development server:
pnpm run dev- Run the unit tests to ensure everything is working properly:
pnpm run test- Open your browser and visit http://localhost:3000 to view the application.
This project uses Drizzle ORM for database management and is configured to work with a Turso database.
-
You should have a Turso database created and have the database URL and authentication token (already covered in the main setup).
-
We will be using the drizzle-kit CLI in the node_modules/.bin directory.
-
Ensure
drizzle.config.tsfile is correctly configured.
After modifying your Drizzle schema (e.g., src/db/schema.ts), generate a migration:
pnpm drizzle-kit generateTo apply the migrations to your database:
pnpm drizzle-kit migrateTo reset the database to the latest migration:
pnpm drizzle-kit resetThis project uses GitHub Actions for automated testing and database migrations.
To enable automated database migrations in CI/CD, you must configure the following secrets in your GitHub repository:
Navigate to: Repository Settings → Secrets and variables → Actions → New repository secret
These secrets are used when code is merged to the main branch:
TURSO_DATABASE_URL_PROD- Production Turso database URL (e.g.,libsql://your-prod-database-url)TURSO_AUTH_TOKEN_PROD- Production Turso authentication token
These secrets are used when pull requests are created for the staging branch:
TURSO_DATABASE_URL_STAGING- Staging/non-production Turso database URL (e.g.,libsql://your-staging-database-url)TURSO_AUTH_TOKEN_STAGING- Staging/non-production Turso authentication token
The .github/workflows/migrate.yml workflow automatically runs database migrations:
- Production: Triggers when code is pushed to
main(after PR merge) - Staging: Triggers when a PR is opened, updated, or reopened targeting the
stagingbranch
Both workflows run pnpm run db:migrate with the appropriate environment credentials.