Introducing the Loggy CLI: From Zero to Logging in Under 60 Seconds
We built a CLI tool that sets up Loggy in your project with a single command. No more copy-pasting tokens, creating config files, or reading documentation. Just run npx @loggydev/loggy-cli init and you're done.
Let me tell you about a problem that’s been bugging us for a while. Every time someone wants to try Loggy, they have to go through the same ritual: sign up, create a project, copy the token, install the SDK, create a config file, paste the token, add it to gitignore, and finally write their first log statement. It works, but it’s not exactly the “start logging in minutes” experience we promised.
We kept thinking about how tools like Vercel and Netlify have these magical CLI experiences where you run one command and everything just works. Why couldn’t logging be that simple? So we built it.
One Command to Rule Them All
Starting today, you can set up Loggy in any JavaScript project with a single command:
npx @loggydev/loggy-cli init
That’s it. No global installs, no configuration files to create manually, no tokens to copy-paste. The CLI handles everything:
🚀 Welcome to Loggy!
Let's get your project set up in under 60 seconds.
✔ Project detected!
Framework: Next.js
Package manager: npm
Project name: my-awesome-app
✔ SDK installed!
📦 Let's connect to Loggy:
? How would you like to authenticate?
❯ Open browser to sign up / log in
I already have a project token
✔ Authenticated as [email protected]
✔ Project created!
✔ Token saved to .env.local
✔ Instrumentation added!
✓ Created src/lib/loggy.ts
✅ Done! Loggy is ready to go.
Your logs will appear at:
https://loggy.dev/dash
Try it out:
import { loggy } from '@/lib/loggy';
loggy.info('Hello from Loggy! 🎉');
The whole process takes about 30 seconds, and most of that is waiting for npm to install the package.
How It Works
When you run npx @loggydev/loggy-cli init, the CLI does a few clever things behind the scenes. First, it looks at your project to figure out what framework you’re using. It checks your package.json for telltale dependencies like next, astro, @remix-run/node, or express. This matters because different frameworks have different conventions for where config files go and how environment variables work.
Next, it detects your package manager by looking for lock files. If it finds yarn.lock, it uses yarn. If it finds pnpm-lock.yaml, it uses pnpm. You get the idea. No more “wait, was it npm install or yarn add?” moments.
Then comes the authentication. The CLI opens your browser to a special auth page on loggy.dev. If you’re already logged in, it grabs your session. If not, you can sign up or log in right there. Once authenticated, the browser redirects back to a local callback URL, and the CLI picks up your auth token automatically. It’s the same OAuth flow you’ve used with GitHub or Google, just applied to a CLI tool.
With your auth token in hand, the CLI creates a new project on Loggy using your local project’s name. It saves the project token to the right environment file for your framework (.env.local for Next.js, .env for most others) and makes sure that file is in your .gitignore.
Finally, it generates a utility file at a sensible location for your framework. For Next.js, that’s src/lib/loggy.ts. For Remix, it’s app/lib/loggy.ts. The file includes a pre-configured Loggy instance that’s ready to use, plus optional exports for metrics and tracing if you’re on a paid plan.
Framework Support
We’ve tested the CLI with all the major JavaScript frameworks:
- Next.js - Detects App Router vs Pages Router, uses
.env.local - Astro - Works with both static and SSR modes
- Remix - Puts the utility file in the
appdirectory where it belongs - SvelteKit - Full support for the
src/libconvention - Nuxt - Uses the
libdirectory and.env - Express - Classic Node.js setup with
lib/loggy.ts - Fastify - Same as Express
- Hono - The new hotness, fully supported
If you’re using something else, the CLI falls back to a sensible Node.js default. And if you’ve got a monorepo or unusual project structure, you can always use the --token flag to skip the interactive flow and just pass an existing project token.
Why This Matters
Developer experience isn’t just about making things easier (though that’s nice). It’s about reducing the friction between “I want to try this” and “I’m actually using this.” Every step in a setup process is an opportunity for someone to get distracted, confused, or just decide it’s not worth the effort.
We’ve seen it in our analytics. People who get their first log into the dashboard within 5 minutes of signing up are way more likely to become regular users than people who take longer. The CLI is our attempt to get everyone into that fast group.
There’s also something to be said for consistency. When the CLI generates your config file, it’s always correct. No typos in the endpoint URL, no accidentally committing your token to git, no forgetting to add the import statement. These little mistakes add up, especially when you’re just trying to quickly add logging to debug something.
What’s Next
This is version 0.1.0, and we’ve got plans. Here’s what’s coming:
We want to add support for updating existing projects. Right now, if you run @loggydev/loggy-cli init in a project that already has Loggy set up, it’ll create a new project. We’d like it to be smart enough to detect the existing setup and offer to update it instead.
We’re also working on additional commands beyond init. Things like loggy tail to stream logs from your terminal, loggy projects to list and switch between projects, and loggy config to update your settings without touching the dashboard.
And of course, we’ll be adding support for our Go and Python SDKs. The framework detection and file generation will need to be different, but the auth flow and project creation will work the same way.
Try It Now
The CLI is available today. Just run:
npx @loggydev/loggy-cli init
If you run into any issues or have suggestions, we’d love to hear from you. The CLI is open source, and we welcome contributions.
Happy logging! 🚀