Welcome to Analog
Relevant source files
The following files were used as context for generating this wiki page:- README.md
- CONTRIBUTING.md
- apps/web/src/app/(auth)/login/page.tsx
- apps/web/src/app/(legal)/privacy/page.tsx
- apps/web/src/components/create-event-input.tsx
- apps/web/src/app/(marketing)/blog/page.tsx
- apps/web/src/app/(marketing)/blog/[slug]/page.tsx
- CODE_OF_CONDUCT.md
- apps/web/src/app/(legal)/terms/page.tsx
- packages/google-calendar/src/internal/qs/LICENSE.md
- packages/google-tasks/src/internal/qs/LICENSE.md
Analog is an open-source calendar application designed to provide a modern and seamless user experience. It integrates with external calendar providers like Google and Microsoft, allowing users to manage their events within a single interface. The project is built with a contemporary technology stack, emphasizing developer productivity and performance.
This document serves as a technical overview of the Analog project, covering its architecture, setup process, core features, and contribution guidelines. It is intended for developers looking to understand, run, or contribute to the project.
Sources: README.md:2-3, README.md:90-92, CONTRIBUTING.md:46-61
Tech Stack
The project utilizes a range of modern technologies for its web application, database, and authentication layers.
| Component | Technologies |
|---|---|
| Web | Next.js, TypeScript, Tailwind v4, Bun, tRPC, TanStack Query, shadcn/ui |
| Database | Drizzle ORM with PostgreSQL |
| Authentication | Better Auth for Google & Microsoft OAuth |
Sources: README.md:90-92
Getting Started
To set up a local development environment for Analog, you must have Bun and Docker Desktop installed. The setup process involves cloning the repository, configuring environment variables, setting up the database, and running the application.
Sources: README.md:15-20
This diagram illustrates the local development setup flow.
Sources: README.md:23-88, CONTRIBUTING.md:8-73
Environment Configuration
Analog requires several environment variables for authentication and API access. These are configured in a .env file created from .env.example.
| Variable | Description |
|---|---|
DATABASE_URL | The connection string for the PostgreSQL database. Defaults to a local Docker instance. |
BETTER_AUTH_URL | The URL for the Better Auth service. Defaults to a local instance. |
BETTER_AUTH_SECRET | A secure secret for Better Auth, generated with openssl rand -hex 32. |
GOOGLE_CLIENT_ID | The client ID for Google OAuth, obtained from the Google Cloud Console. |
GOOGLE_CLIENT_SECRET | The client secret for Google OAuth. |
MICROSOFT_CLIENT_ID | (Optional) The client ID for Microsoft OAuth, from the Azure Portal. |
MICROSOFT_CLIENT_SECRET | (Optional) The client secret for Microsoft OAuth. |
GOOGLE_MAPS_API_KEY | An API key for the Google Places API, used for location features. |
Sources: README.md:32-77, CONTRIBUTING.md:26-61
Authentication
Authentication is managed via Better Auth, which facilitates OAuth 2.0 flows with providers like Google and Microsoft.
Login Flow
When a user attempts to sign in, they are directed through an OAuth flow. The login/page.tsx component handles the initial state. If a user is already authenticated, they are redirected to /calendar. If the login process returns with an error, such as required_scopes_missing, an alert is displayed prompting the user to sign in again and grant the necessary permissions.
Sources: apps/web/src/app/(auth)/login/page.tsx:18-28
The following diagram shows the sequence of events during a Google login.
Google User Data
Analog accesses specific Google user data to provide its calendar features. The application's privacy policy explicitly states what data is accessed and why.
- What is accessed: Google email address, basic profile, list of calendars, and event details (title, time, description, attendees).
- Why it is accessed: To enable sign-in, display calendars and events, and allow users to add/edit events from within Analog.
- Usage Limitation: Google user data is never used for ads, marketing, or profiling. Human access is disallowed except with explicit user permission, for security/debugging, or as required by law.
All Google user data is encrypted in transit (TLS 1.3) and at rest (AES-256). Users can revoke access at any time via their Google Account settings.
Sources: apps/web/src/app/(legal)/privacy/page.tsx:103-125, apps/web/src/app/(legal)/privacy/page.tsx:173-176, apps/web/src/app/(legal)/privacy/page.tsx:254-263
Core Features
Natural Language Event Creation
A key feature of Analog is the ability to create events using natural language. This is powered by the CreateEventInput component, which uses the Tiptap editor.
The editor is configured with a Mention extension that recognizes @-prefixed triggers for dates, times, and durations. When a user types, for example, Sales meeting at @22:00, the component parses the input to structure the event data.
The handleSubmit function extracts the plain text title and the structured mention nodes. It then uses the createEventDescription helper to generate a human-readable summary of the event, which is displayed in a success toast upon creation.
Sources: apps/web/src/components/create-event-input.tsx
This diagram shows the logic for creating an event from user input.
Blog
Analog includes a blog for news and updates, which is statically generated for performance.
- Blog Index (
/blog): The main blog page, rendered byapps/web/src/app/(marketing)/blog/page.tsx, fetches all posts usinggetPosts()and displays them in a grid. This page is revalidated every 3600 seconds. - Individual Posts (
/blog/[slug]): Each post page is rendered byapps/web/src/app/(marketing)/blog/[slug]/page.tsx. ThegenerateStaticParamsfunction is used to pre-render all blog post pages at build time based on their slugs. ThegetSinglePost(slug)function retrieves the content for a specific post.
Sources: apps/web/src/app/(marketing)/blog/page.tsx, apps/web/src/app/(marketing)/blog/[slug]/page.tsx
Database
The application uses a PostgreSQL database managed with Drizzle ORM. For local development, the database runs in a Docker container orchestrated by docker-compose.yml.
The following commands are used for database management:
bun run docker:up: Starts the PostgreSQL container.bun run db:push: Pushes the Drizzle schema to the database, initializing or updating tables.
Sources: README.md:80-88, CONTRIBUTING.md:63-67
Contributing
Contributions to Analog are welcome. The process follows a standard fork-and-pull-request model.
- Fork the repository.
- Create a new feature branch (
git checkout -b feature/your-feature). - Make changes and commit them using Conventional Commit messages (e.g.,
feat: add new feature). - Push the branch to your fork and open a Pull Request against the main repository.
All contributors are expected to adhere to the project's Code of Conduct.
Sources: CONTRIBUTING.md:75-97, CODE_OF_CONDUCT.md