npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

google-oauth-cli-generator

v1.0.0

Published

CLI tool to quickly set up Google OAuth authentication for hackathons and projects

Readme

🚀 CipherAI Auth Setup CLI

A powerful CLI tool to quickly set up Google OAuth authentication for hackathons and projects. Generate complete authentication boilerplates in seconds!

npm version License: MIT

✨ Features

  • 🔐 Complete Google OAuth Setup - Full authentication flow with Passport.js
  • Multiple Frontend Frameworks - React, Next.js, or Vanilla JavaScript
  • 🚀 Backend Options - Express.js or Fastify
  • 💾 Database Support - MongoDB, PostgreSQL, or in-memory storage
  • 🎨 Beautiful UI - Pre-styled login components with modern design
  • 📦 Zero Configuration - Just run and answer prompts
  • 🧪 Test Ready - Includes comprehensive test suites
  • 📚 Documentation - Complete setup guides and examples

🚀 Quick Start

Installation

# Install globally
npm install -g @cipherai/auth-setup

# Or use npx (recommended)
npx @cipherai/auth-setup setup

Usage

# Initialize new authentication project
cipherai-auth setup

# Or using npx
npx @cipherai/auth-setup setup

📋 Prerequisites

Before running the CLI, you'll need:

  1. Google Cloud Console Project

  2. OAuth 2.0 Credentials

    • Navigate to "APIs & Services" > "Credentials"
    • Click "Create Credentials" > "OAuth client ID"
    • Choose "Web Application"
    • Add your redirect URI (e.g., http://localhost:3000/auth/google/callback)

🎯 What You'll Get

The CLI will ask you a few questions and generate a complete project structure:

📝 Questions Asked

  1. Google OAuth Client ID - Your Google OAuth client ID
  2. Google OAuth Client Secret - Your Google OAuth client secret
  3. Redirect URI - OAuth callback URL (default: http://localhost:3000/auth/google/callback)
  4. Frontend Framework - React, Next.js, or Vanilla JavaScript
  5. Backend Framework - Express.js or Fastify
  6. Database - MongoDB, PostgreSQL, or none (in-memory)
  7. Project Name - Name for your project folder

📁 Generated Structure

your-project/
├── frontend/              # Frontend application
│   ├── src/
│   │   ├── components/    # Login/Profile components
│   │   ├── App.tsx        # Main application
│   │   └── ...
│   ├── package.json
│   └── ...
├── backend/               # Backend API server
│   ├── src/
│   │   ├── routes/        # Authentication routes
│   │   ├── config/        # Passport & database config
│   │   ├── models/        # User models (if database selected)
│   │   └── index.ts       # Server entry point
│   ├── package.json
│   └── ...
├── .env.example           # Environment variables template
├── .gitignore            # Git ignore rules
└── README.md             # Project documentation

🛠 Supported Tech Stacks

Frontend Options

  • React - Modern React with TypeScript, Vite, and styled components
  • Next.js - Next.js 14 with App Router and TypeScript
  • Vanilla JS - Pure JavaScript with modern ES6+ features

Backend Options

  • Express.js - Popular Node.js framework with Passport.js
  • Fastify - High-performance alternative to Express

Database Options

  • MongoDB - NoSQL database with Mongoose ODM
  • PostgreSQL - Relational database with native pg driver
  • None - In-memory storage for quick prototypes

🚀 Getting Started (After Generation)

  1. Navigate to your project

    cd your-project-name
  2. Set up environment variables

    cp .env.example .env
    # Edit .env with your actual values
  3. Install dependencies

    # Frontend
    cd frontend && npm install
       
    # Backend  
    cd ../backend && npm install
  4. Start development servers

    # Terminal 1 - Backend
    cd backend && npm run dev
       
    # Terminal 2 - Frontend
    cd frontend && npm run dev
  5. Open your browser

    • Frontend: http://localhost:3000
    • Backend API: http://localhost:5000

🔧 Environment Variables

Required Variables

# Google OAuth Configuration
GOOGLE_CLIENT_ID=your-client-id.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=your-client-secret
REDIRECT_URI=http://localhost:3000/auth/google/callback

# Session Configuration
SESSION_SECRET=your-session-secret-change-in-production

# Database Configuration (if using database)
MONGODB_URI=mongodb://localhost:27017/your-app
# OR
DATABASE_URL=postgresql://username:password@localhost:5432/your_app

# Application Configuration
PORT=5000
NODE_ENV=development
FRONTEND_URL=http://localhost:3000

📚 API Reference

Authentication Endpoints

  • GET /api/auth/google - Initiate Google OAuth flow
  • GET /api/auth/google/callback - OAuth callback handler
  • GET /api/auth/user - Get current authenticated user
  • POST /api/auth/logout - Logout user

Health Check

  • GET /api/health - Server health status

🧪 Testing

The generated project includes comprehensive test suites:

# Run tests
npm test

# Run tests with coverage
npm run test:coverage

# Run tests in watch mode
npm run test:watch

🚀 Deployment

Frontend Deployment

Vercel (Recommended for Next.js)

npm install -g vercel
vercel

Netlify (Great for React/Vanilla)

npm run build
# Upload dist/ folder to Netlify

Backend Deployment

Railway

npm install -g @railway/cli
railway login
railway init
railway up

Heroku

heroku create your-app-name
git push heroku main

Environment Variables in Production

Remember to set these in your deployment platform:

  • GOOGLE_CLIENT_ID
  • GOOGLE_CLIENT_SECRET
  • REDIRECT_URI (update to production URL)
  • SESSION_SECRET (generate a secure random string)
  • Database connection strings
  • NODE_ENV=production

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Setup

# Clone the repository
git clone https://github.com/cipherai/auth-setup.git
cd auth-setup

# Install dependencies
npm install

# Run in development mode
npm run dev

# Run tests
npm test

# Build for production
npm run build

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

🐛 Issues & Support

🙏 Acknowledgments

📊 Stats

GitHub stars GitHub forks GitHub issues GitHub pull requests


Made with ❤️ by CipherAI for the developer community