- Expanded the IAM Service README to include a detailed overview, features showcase, and quick start guide. - Updated API reference with new endpoints for health checks and identity management. - Improved implementation details, including completed features and module dependencies. - Enhanced architecture documentation with clear diagrams and structured sections for better understanding. - Added quick reference tables for API endpoints across various modules, improving accessibility for developers. These changes aim to provide a clearer, more comprehensive understanding of the IAM Service's capabilities and usage.
4.7 KiB
4.7 KiB
Quick Start Guide
🚀 Getting Started
1. Install Dependencies
pnpm install
2. Setup Environment
cp env.local.example .env.local
# Edit .env.local with your configuration
3. Setup Database
# Generate Prisma Client
pnpm prisma:generate
# Run migrations
pnpm prisma:migrate
# Seed database (creates admin user)
pnpm prisma:seed
4. Start Development Server
pnpm dev
Service will start on http://localhost:3001
📝 Default Credentials
After seeding:
- Admin:
admin@goodgo.com/admin123 - Test User:
test@goodgo.com/test123
🔑 API Testing
The IAM Service provides 50+ endpoints across 10 modules. Here are quick examples for the main modules:
Authentication Module
curl -X POST http://localhost:3001/api/v1/auth/register \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"password": "SecurePass123!"
}'
Login
curl -X POST http://localhost:3001/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "admin@goodgo.com",
"password": "admin123"
}'
Get Current User
curl -X GET http://localhost:3001/api/v1/auth/me \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Check Permissions
curl -X GET "http://localhost:3001/api/v1/rbac/permissions/check?resource=users&action=read&scope=all" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Identity Management Module
Manage users, profiles, organizations, and groups:
# List users
curl -X GET http://localhost:3001/api/v1/identity/users \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
# Get user profile
curl -X GET http://localhost:3001/api/v1/identity/users/{userId}/profile \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Access Management Module
Handle access requests, reviews, and analytics:
# Create access request
curl -X POST http://localhost:3001/api/v1/access/requests \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"resource": "users",
"action": "write",
"scope": "all",
"reason": "Need access to manage users"
}'
# List access requests
curl -X GET http://localhost:3001/api/v1/access/requests \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Governance & Compliance Module
Compliance reporting, risk management, and policy templates:
# Get risk scores
curl -X GET http://localhost:3001/api/v1/governance/risk/scores \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
# List compliance reports
curl -X GET http://localhost:3001/api/v1/governance/compliance/reports \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
For complete API documentation, see API Reference.
🔐 Social Login Setup
Google OAuth
- Go to Google Cloud Console
- Create OAuth 2.0 credentials
- Add to
.env.local:GOOGLE_CLIENT_ID=your-client-id GOOGLE_CLIENT_SECRET=your-client-secret GOOGLE_REDIRECT_URI=http://localhost:3001/api/v1/auth/google/callback
Facebook OAuth
- Go to Facebook Developers
- Create App and get credentials
- Add to
.env.local:FACEBOOK_APP_ID=your-app-id FACEBOOK_APP_SECRET=your-app-secret FACEBOOK_REDIRECT_URI=http://localhost:3001/api/v1/auth/facebook/callback
GitHub OAuth
- Go to GitHub Settings > Developer settings > OAuth Apps
- Create new OAuth App
- Add to
.env.local:GITHUB_CLIENT_ID=your-client-id GITHUB_CLIENT_SECRET=your-client-secret GITHUB_REDIRECT_URI=http://localhost:3001/api/v1/auth/github/callback
🔒 MFA Setup
Enable TOTP
- Call
POST /api/v1/mfa/totp/enableto get QR code - Scan QR code with authenticator app (Google Authenticator, Authy, etc.)
- Call
POST /api/v1/mfa/totp/verifywith token from app
📊 Health Checks
GET /health- Basic health checkGET /health/ready- Readiness probe (checks database)GET /health/live- Liveness probe
🐳 Docker Deployment
cd ../../deployments/local
docker-compose up -d iam-service
📚 Documentation
- See
README.mdfor full documentation - See
IMPLEMENTATION.mdfor implementation details - API docs available at
/api-docswhen running
🛠️ Troubleshooting
Database Connection Issues
- Check
DATABASE_URLin.env.local - Ensure database is running
- Run
pnpm prisma:generateif schema changed
Redis Connection Issues
- Check
REDIS_URLin.env.local - Ensure Redis is running
- Default:
redis://localhost:6379
JWT Errors
- Ensure
JWT_SECRETis set in.env.local - Use strong, random secrets in production
- Never commit secrets to git