Skip to content

Instafication is a smart notification service that monitors booking systems and instantly alerts you via email when new appointment slots become available.

License

Notifications You must be signed in to change notification settings

instafication/frontend

Repository files navigation

πŸ“± Instafication - Smart Booking Notifications

SvelteKit TypeScript Tailwind CSS Drizzle

Instafication is a smart notification service that monitors booking systems and instantly alerts you via SMS or email when new appointment slots become available. Never miss a booking opportunity again!

✨ Features

  • πŸ”” Real-time Notifications - Get instant SMS/email alerts when bookings become available
  • 🏠 Multi-Service Support - Monitor laundry, parking, rental bookings and more
  • 🌍 Internationalization - Available in multiple languages (Swedish, English)
  • πŸ’³ Flexible Pricing - Pay-per-use or monthly subscription options
  • πŸ“± Responsive Design - Works seamlessly on desktop and mobile
  • πŸ” Secure Authentication - Google OAuth and email/password login
  • ⚑ High-Performance Scraping - Efficient monitoring with configurable intervals
  • 🎯 Smart Filtering - Get notifications only for your preferred areas and timeframes

πŸš€ Quick Start

Prerequisites

  • Node.js 22.x or higher (Bun 1.2+ recommended)
  • Cloudflare D1 database
  • BetterAuth (email/password) with Drizzle ORM
  • Stripe account (for payments)

Installation

  1. Clone the repository

    git clone https://github.com/instafication/frontend.git
    cd frontend
  2. Install dependencies

    bun install
  3. Set up environment variables Create a .env file in the root directory (values are examples):

    BETTER_AUTH_SECRET=your_random_secret
    # Public analytics (optional)
    PUBLIC_POSTHOG_KEY=phc_xxx
    PUBLIC_POSTHOG_HOST=https://eu.i.posthog.com
    STRIPE_PUBLISHABLE_KEY=your_stripe_publishable_key
    STRIPE_SECRET_KEY=your_stripe_secret_key
    STRIPE_WEBHOOK_SECRET=your_stripe_webhook_secret
  4. Set up the database

    # Generate migrations from the Drizzle schema
    bun run generate
    
    # Apply to the local SQLite file (dev.db) or to D1 if configured
    bun run push
  5. Apply D1 migrations (remote D1) If you're targeting a remote Cloudflare D1, ensure you have valid credentials in wrangler.toml or env variables used by drizzle.config.ts, then:

    bun run migrate:prod
  6. Start the development server

    # Option A: Vite dev server (no CF bindings, good for UI work)
    bun run dev
    
    # Option B: Full Cloudflare Workers dev with D1 bindings
    bunx wrangler dev --x-remote-bindings --port=5173 --local --persist-to=.wrangler/state

Visit http://localhost:5173 to see the application running!

πŸ› οΈ Development

Available Scripts

  • bun run build - Build for production
  • bun run dev - Start development server
  • bun run deploy - Deploy project to Cloudflare

Project Structure

src/
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ Components/          # Reusable Svelte components
β”‚   β”œβ”€β”€ Managers/           # Business logic managers
β”‚   β”œβ”€β”€ server/             # Server-side utilities
β”‚   β”œβ”€β”€ i18n.ts            # Internationalization
β”‚   └── translations.ts    # Translation strings
β”œβ”€β”€ routes/
β”‚   β”œβ”€β”€ +layout.svelte     # Main layout
β”‚   β”œβ”€β”€ +page.svelte       # Landing page
β”‚   β”œβ”€β”€ [...api]/          # API routes
β”‚   β”œβ”€β”€ payment/           # Payment handling
β”‚   └── webhook/           # Webhook endpoints
└── app.html               # HTML template

Tech Stack

  • Frontend: SvelteKit with TypeScript
  • Styling: Tailwind CSS + Flowbite + Bits UI/shadcn-svelte ports
  • Database: Cloudflare D1 with Drizzle ORM
  • Authentication: BetterAuth (D1 + Drizzle)
  • Payments: Stripe integration
  • Deployment: Cloudflare Workers support
  • Email: Resend integration

Authentication

  • Email/password is enabled with BetterAuth. In development, email verification is disabled.
  • On successful sign‑up, a session cookie is set and the UI auto‑logs in. No activation email is sent in dev.
  • Key endpoints (served under basePath /api/auth):
    • POST /api/auth/sign-up/email with { email, password }
    • POST /api/auth/sign-in/email with { email, password }

πŸ“Š Database Schema

Core tables include:

  • Product tables: profiles, services, scrapers, notifications
  • Auth tables (BetterAuth): users, sessions, accounts, verifications, apikeys

Generated auth schema lives at drizzle/generated.auth.schema.ts. If you upgrade BetterAuth and need to refresh the schema, regenerate with the BetterAuth CLI.

πŸ”§ Configuration

Service Configuration

Users can configure:

  • Notification method (Email)
  • Notification timing (1 hour, 1 day, 2 days in advance)
  • Service areas (e.g., specific housing areas)
  • Service types (laundry, parking, rentals)

Scraper Configuration

Administrators can configure:

  • Scraping frequency (minutes)
  • Target companies/services
  • Service parameters
  • Monitoring areas

πŸš€ Deployment

Cloudflare

  1. Install Wrangler: bun i -g wrangler
  2. Configure wrangler.toml
  3. Run: bun run deploy

Optional envs used by drizzle.config.ts when pushing via HTTP driver:

export DRIZZLE_USE_D1=1
export CLOUDFLARE_ACCOUNT_ID=...
export CLOUDFLARE_DATABASE_ID=...
export CLOUDFLARE_D1_TOKEN=...

Troubleshooting

  • If sign‑up returns 4xx due to schema mismatches, regenerate and push migrations, then apply to remote D1:
    • bun run generate && bun run push (local) or bun run migrate:prod (remote)
  • To inspect D1 during dev:
    • wrangler d1 execute prod --remote --command "PRAGMA table_info('users');"

πŸ’° Pricing Model

Instafication offers two pricing tiers:

  1. Pay-per-notification: 9 SEK for 2 notifications
  2. Monthly subscription: 19 SEK/month for unlimited notifications (30-day free trial)

🌐 Supported Services

Currently supports:

  • Stockholms StudentbostΓ€der (SSSB) - Laundry booking monitoring
  • More services coming soon!

🀝 Contributing

We welcome contributions! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'Add amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

Code Style

  • Use TypeScript for all new code
  • Follow the existing code formatting (Rome)
  • Add JSDoc comments for complex functions
  • Use semantic commit messages

Webhooks

  • Stripe payment webhooks
  • Notification delivery webhooks

πŸ” Security

  • All API routes are protected with authentication
  • Sensitive data is encrypted
  • CORS properly configured
  • Rate limiting on API endpoints

πŸ“„ License

MIT License β€” see LICENSE for details.


Made with ❀️ by the Instafication team

About

Instafication is a smart notification service that monitors booking systems and instantly alerts you via email when new appointment slots become available.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •