Birrino is a clean, minimalist web application for tracking alcohol consumption. It helps users monitor their alcohol units and stay within healthy limits (recommended 14 units per week).
- Track alcohol consumption by units
- Select from predefined drinks with standard volumes and ABV percentages
- View summaries for evening, day, week, month, and year
- Anonymous, per-device authentication
- Visual progress indicators
- Notifications when exceeding recommended limits
- Node.js 18 or newer
- npm 9 or newer
- Supabase project (apply migrations in
migrations/anonymous_auth.sql)
-
Clone the repository:
git clone <repository-url> cd birrino
-
Install dependencies:
npm install
-
Set up environment variables:
- Copy
.env.local.exampleto.env.local - Fill in your Supabase URL and anon key:
NEXT_PUBLIC_SUPABASE_URL=https://your-project-id.supabase.co NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
- Copy
-
Run the development server:
npm run dev
-
Open http://localhost:3000 in your browser.
The application uses the following Supabase tables:
create table drinks (
id uuid primary key default gen_random_uuid(),
name text not null,
volume_ml int not null,
abv numeric(4,1) not null,
type text not null
);create table profiles (
id uuid primary key references auth.users(id) on delete cascade,
display_name text not null
);create table consumption (
id uuid primary key default gen_random_uuid(),
drink_id uuid not null,
quantity int not null,
units numeric not null,
timestamp timestamptz default now(),
user_id uuid references auth.users(id)
);- Select or create a user profile
- Select a drink type and specific drink
- Adjust the quantity using the slider
- Click "Add Drink" to record your consumption
- View your consumption summary in the stats panel
- Receive notifications when you exceed 14 units per week
To create a production build:
npm run build
npm run startThis project includes an automated system to prevent the Supabase database from pausing due to inactivity.
- GitHub Actions pings the
/api/keepaliveendpoint every 3 days - The endpoint performs lightweight database queries to keep Supabase active
- Runs automatically, no manual intervention needed
The following environment variables must be configured by the developer:
In Vercel Dashboard:
SUPABASE_URL: Supabase project URLSUPABASE_SERVICE_ROLE_KEY: Service role key from Supabase dashboardKEEPALIVE_SECRET: Random secret string for endpoint security
In GitHub Repository Secrets:
KEEPALIVE_URL: Complete URL with secret parameter for the keepalive endpoint
After setup, test the endpoint:
curl "https://your-app.vercel.app/api/keepalive?secret=your_secret"Expected response:
{
"ok": true,
"timestamp": "2024-06-30T12:00:00.000Z",
"tables_checked": ["drinks", "consumption"],
"status": "Database connection successful"
}- Check GitHub Actions tab for automated run status
- Workflow runs every 3 days at 12:00 UTC
- Can be triggered manually from GitHub Actions interface
- Failed runs will appear with error indicators
- API Endpoint:
/app/api/keepalive/route.ts- Secure endpoint that queries database - GitHub Workflow:
.github/workflows/keepalive.yml- Automated scheduler - Security: Secret parameter prevents unauthorized access
- Reliability: Multiple table queries ensure comprehensive database activity
This project is licensed under the MIT License - see the LICENSE file for details.