Skip to content

terekhindc/AuthOSphere

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” Authosphere

Complete authentication solution with database integration for Node.js and React applications.

License: MIT Node.js React

✨ Features

  • πŸ”‘ JWT Authentication - Secure token-based authentication
  • 🌐 OAuth Integration - Google, GitHub, and more OAuth providers
  • ⚑ Plug-and-Play - Minimal configuration required
  • πŸ›‘οΈ Security First - Rate limiting, CORS, Helmet protection
  • πŸ“± React Components - Ready-to-use React authentication components
  • 🎯 TypeScript Ready - Full TypeScript support
  • πŸ“š Comprehensive Examples - Complete working examples
  • πŸ—„οΈ Database Integration - MongoDB, PostgreSQL, Redis support
  • πŸ”„ Hybrid Storage - Primary storage + Redis caching
  • πŸ“Š Health Monitoring - Built-in health checks and monitoring

πŸš€ Quick Start

1. Installation

npm install @authosphere/nodejs-auth-module
npm install @authosphere/react-auth-component

2. Run Examples (Recommended)

# Clone the repository
git clone https://github.com/your-username/authosphere.git
cd authosphere

# Install all databases (macOS)
./scripts/setup/setup-databases.sh

# Run full stack application (Backend + React Frontend)
./scripts/examples/start-full-stack.sh

# Or run backend only
./scripts/examples/start-example.sh

# Or run React frontend only
./scripts/examples/start-react-example.sh

Available storage types:

  • In-Memory - No setup required, data lost on restart
  • MongoDB - NoSQL database with Mongoose
  • PostgreSQL - Relational database with Prisma ORM
  • Redis - In-memory storage for sessions and tokens
  • Hybrid - PostgreSQL + Redis caching

URLs after startup:

πŸ“– See FULL_STACK_GUIDE.md for complete instructions

3. Backend Setup (Node.js/Express)

import express from 'express';
import { createAuthosphere } from '@authosphere/nodejs-auth-module';

const app = express();

// Configure Authosphere
const authosphere = createAuthosphere({
  jwtSecret: 'your-super-secret-jwt-key',
  storage: {
    type: 'mongodb', // or 'postgresql', 'redis', 'memory'
    options: {
      uri: 'mongodb://localhost:27017/authosphere'
    }
  },
  oauth: {
    google: {
      clientId: 'your-google-client-id',
      clientSecret: 'your-google-client-secret'
    }
  },
  frontendUrl: 'http://localhost:3000'
});

// Use Authosphere middleware
app.use('/auth', authosphere);

app.listen(3000, () => {
  console.log('Server running on port 3000');
});

4. Frontend Setup (React)

import React from 'react';
import { AuthProvider, ProtectedRoute } from '@authosphere/react-auth-component';

function App() {
  return (
    <AuthProvider apiUrl="http://localhost:3000/auth">
      <ProtectedRoute>
        <h1>Welcome to your protected app!</h1>
      </ProtectedRoute>
    </AuthProvider>
  );
}

export default App;

πŸ“– Documentation

🎯 Use Cases

  • Web Applications - Full-stack web apps with authentication
  • SPA (Single Page Apps) - React, Vue, Angular applications
  • Mobile Apps - React Native with authentication backend
  • Microservices - JWT-based service authentication
  • Admin Panels - Protected admin interfaces

πŸ”§ Configuration

Environment Variables

# JWT Configuration
JWT_SECRET=your-super-secret-jwt-key-change-in-production

# Database Configuration
MONGODB_URI=mongodb://localhost:27017/authosphere
DATABASE_URL=postgresql://user:pass@localhost:5432/authosphere
REDIS_URL=redis://localhost:6379
STORAGE_TYPE=mongodb

# OAuth Providers
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret

# Frontend URL
FRONTEND_URL=http://localhost:3000

OAuth Providers

Authosphere supports multiple OAuth providers:

  • βœ… Google - Full support
  • βœ… GitHub - Full support
  • βœ… Facebook - Full support
  • πŸ”„ Discord - Coming soon
  • πŸ”„ Twitter - Coming soon

πŸ“¦ Packages

Package Description Version
@authosphere/nodejs-auth-module Backend authentication module 2.0.0
@authosphere/react-auth-component React authentication components 2.0.0

πŸ› οΈ Development

Prerequisites

  • Node.js 16+
  • npm 8+

Setup Development Environment

# Clone the repository
git clone https://github.com/your-org/authosphere.git
cd authosphere

# Install dependencies
npm install

# Start development servers
npm run dev

Available Scripts

npm start          # Start both backend and frontend
npm run dev        # Start in development mode
npm run build      # Build all packages
npm test           # Run tests
npm run lint       # Run linter

πŸ“„ License

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

🀝 Contributing

We welcome contributions! Please follow these steps:

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

πŸ“ž Support

πŸ™ Acknowledgments


Made with ❀️ by Terekhin Digital Crew

All rights reserved. Copyright Β© 2025 Terekhin Digital Crew

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors