
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@diagramers/api
Advanced tools
Diagramers API - A comprehensive Node.js API template with TypeScript, Firebase Functions, and Socket.io
A comprehensive, modular, and extensible Node.js API framework built with TypeScript, featuring multi-provider authentication, plugin system, unified response handling, Swagger documentation, Socket.IO real-time communication, and MongoDB support.
# Install CLI globally
npm install -g @diagramers/cli
# Create new API project
diagramers init api my-new-api
cd my-new-api
# Install dependencies
npm install
# Start development
npm start
npm install @diagramers/api
# Create new project
diagramers init api my-ecommerce-api
cd my-ecommerce-api
# Set up environment
cp .env.example .env
# Edit .env with your configuration
# Install dependencies
npm install
# Create products module with CRUD operations
diagramers extend --module products --crud
# Add categories table to products module
diagramers extend --table products:categories --fields name,description,slug
# Add products table to products module
diagramers extend --table products:products --fields name,price,description,category_id
# Create relationship between categories and products
diagramers extend --relation products:category-product:one-to-many
# Add search endpoint
diagramers extend --endpoint products:search --method GET --description "Search products"
# Add featured products endpoint
diagramers extend --endpoint products:featured --method GET --description "Get featured products"
# Seed the database
npm run seed
# Start development server
npm start
Your API will be available at http://localhost:3000
with:
http://localhost:3000/api-docs
http://localhost:3000/health
http://localhost:3000/api/products/*
# Generate module with CRUD operations
diagramers extend --module products --crud
# Generate module with custom fields
diagramers extend --module users --fields email,username,role --crud
# Add table to existing module
diagramers extend --table products:categories --fields name,description,slug
# Add table with various field types
diagramers extend --table users:profiles --fields bio,avatar,birth_date,is_verified
# Add GET endpoint
diagramers extend --endpoint products:search --method GET
# Add POST endpoint with custom path
diagramers extend --endpoint users:reset-password --method POST --path /reset-password
# One-to-many relation (default)
diagramers extend --relation products:category-product
# One-to-one relation
diagramers extend --relation users:user-profile:one-to-one
# Many-to-many relation
diagramers extend --relation products:product-tag:many-to-many
# Run database seeding
npm run seed
# Reset and reseed database
npm run seed --reset
my-api-project/
โโโ src/
โ โโโ modules/ # Feature modules
โ โ โโโ products/
โ โ โ โโโ controllers/ # HTTP request handlers
โ โ โ โโโ entities/ # TypeScript interfaces
โ โ โ โโโ schemas/ # Database schemas
โ โ โ โโโ services/ # Business logic
โ โ โ โโโ routes/ # API routes
โ โ โโโ users/
โ โโโ core/ # Core functionality
โ โ โโโ app.ts # Application setup
โ โ โโโ config/ # Configuration management
โ โ โโโ database/ # Database connection & seeding
โ โ โโโ logging/ # Logging system
โ โ โโโ server/ # Server management
โ โโโ shared/ # Shared utilities
โ โ โโโ constants/ # Application constants
โ โ โโโ types/ # TypeScript types
โ โ โโโ utils/ # Utility functions
โ โโโ main.ts # Application entry point
โโโ scripts/ # Build and utility scripts
โโโ certs/ # SSL certificates
โโโ .env.example # Environment template
โโโ package.json
# Database Configuration
DATABASE_URL=mongodb://localhost:27017/my-api
DATABASE_NAME=my-api
# Server Configuration
PORT=3000
NODE_ENV=development
# Authentication
JWT_SECRET=your-secret-key
JWT_EXPIRATION=24h
# Firebase (optional)
FIREBASE_PROJECT_ID=your-project-id
FIREBASE_PRIVATE_KEY=your-private-key
FIREBASE_CLIENT_EMAIL=your-client-email
# Third-party Services
TWILIO_ACCOUNT_SID=your-twilio-sid
TWILIO_AUTH_TOKEN=your-twilio-token
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your-email@gmail.com
SMTP_PASS=your-email-password
# Odoo ERP Integration
ODOO_ENABLED=true
ODOO_URL=your-odoo-server.com
ODOO_PORT=8069
ODOO_PROTOCOL=http
ODOO_USERNAME=your-odoo-username
ODOO_PASSWORD=your-odoo-password
ODOO_DATABASE=your-odoo-database
ODOO_COMPANY=1
// src/core/config/index.ts
export const config = {
database: {
url: process.env.DATABASE_URL || 'mongodb://localhost:27017/my-api',
name: process.env.DATABASE_NAME || 'my-api',
options: {
useNewUrlParser: true,
useUnifiedTopology: true,
}
},
server: {
port: parseInt(process.env.PORT || '3000'),
cors: {
origin: process.env.CORS_ORIGIN || '*',
credentials: true
}
}
};
The Diagramers API provides a comprehensive email system with multi-provider support, template management, and flexible configuration. The email system is designed to handle transactional emails, notifications, and marketing communications with high deliverability and reliability.
# In your .env file
EMAIL_ENABLED=true
EMAIL_DEFAULT_PROVIDER=smtp
EMAIL_SMTP_HOST=smtp.gmail.com
EMAIL_SMTP_PORT=587
EMAIL_SMTP_SECURE=false
EMAIL_SMTP_USER=your-email@gmail.com
EMAIL_SMTP_PASS=your-app-password
EMAIL_FROM_NAME=Your App Name
EMAIL_FROM_EMAIL=noreply@yourapp.com
# Using the email API endpoint
curl -X POST http://localhost:3000/api/email/send \
-H "Content-Type: application/json" \
-d '{
"userId": "system",
"code": "gmail",
"to": "user@example.com",
"subject": "Welcome to Our App!",
"body": "<h1>Welcome!</h1><p>Thank you for joining our platform.</p>"
}'
# List all email configurations
GET /api/email/configs
# Create new email configuration
POST /api/email/configs
{
"provider": "smtp",
"code": "gmail",
"credentials": {
"service": "gmail",
"auth": {
"user": "your-email@gmail.com",
"pass": "your-app-password"
}
},
"fromName": "Your App",
"fromEmail": "your-email@gmail.com"
}
# Update email configuration
PUT /api/email/configs/{id}
{
"fromName": "Updated App Name"
}
# Delete email configuration
DELETE /api/email/configs/{id}
POST /api/email/send
{
"userId": "system",
"code": "gmail",
"to": "recipient@example.com",
"subject": "Email Subject",
"body": "<h1>Email Content</h1><p>This is the email body.</p>"
}
# Get all configurations
GET /api/email/configs
# Get specific configuration
GET /api/email/configs/{id}
# Create configuration
POST /api/email/configs
{
"provider": "smtp",
"code": "gmail",
"credentials": {
"service": "gmail",
"auth": {
"user": "your-email@gmail.com",
"pass": "your-app-password"
}
},
"fromName": "Your App",
"fromEmail": "your-email@gmail.com"
}
# Update configuration
PUT /api/email/configs/{id}
{
"fromName": "Updated Name"
}
# Delete configuration
DELETE /api/email/configs/{id}
EMAIL_SMTP_HOST=smtp.gmail.com
EMAIL_SMTP_PORT=587
EMAIL_SMTP_SECURE=false
EMAIL_SMTP_USER=your-email@gmail.com
EMAIL_SMTP_PASS=your-16-digit-app-password
EMAIL_PROVIDER=sendgrid
EMAIL_SENDGRID_API_KEY=your-sendgrid-api-key
EMAIL_FROM_EMAIL=verified-sender@yourdomain.com
EMAIL_PROVIDER=ses
EMAIL_AWS_REGION=us-east-1
EMAIL_AWS_ACCESS_KEY_ID=your-access-key
EMAIL_AWS_SECRET_ACCESS_KEY=your-secret-key
EMAIL_FROM_EMAIL=verified@yourdomain.com
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>{{subject}}</title>
</head>
<body>
<div style="max-width: 600px; margin: 0 auto; padding: 20px;">
<h1 style="color: #333;">{{title}}</h1>
<p style="color: #666;">{{content}}</p>
<div style="margin-top: 30px; padding-top: 20px; border-top: 1px solid #eee;">
<p style="font-size: 12px; color: #999;">
This email was sent from {{appName}}
</p>
</div>
</div>
</body>
</html>
// In your email service
const emailData = {
to: 'user@example.com',
subject: 'Welcome to Our Platform',
body: `
<h1>Welcome!</h1>
<p>Thank you for joining our platform.</p>
<a href="${verificationLink}">Verify your email</a>
`
};
await emailService.sendEmail('system', 'gmail', emailData);
// src/modules/email/providers/custom-email-provider.ts
import { BaseEmailProvider } from './base-email-provider';
export class CustomEmailProvider extends BaseEmailProvider {
async send(options: any): Promise<void> {
// Your custom email sending logic
const { to, subject, body, from } = options;
// Implement your email sending here
// Example: API call to your email service
}
}
// In your application code
import { EmailService } from './modules/email/services/email.service';
const emailService = new EmailService();
// Send email using configured provider
await emailService.sendEmail(
'system', // userId
'gmail', // provider code
'user@example.com', // to
'Welcome!', // subject
'<h1>Welcome!</h1>' // body
);
# Enable email debugging
EMAIL_DEBUG=true
LOG_LEVEL=debug
For a complete list of all email environment variables, see the .env.example
file which includes:
The Diagramers API provides comprehensive user management capabilities with role-based access control, profile management, and flexible user data handling. The user system is designed to scale from simple applications to complex enterprise solutions.
# Register new user
POST /api/auth/register
{
"email": "user@example.com",
"password": "SecurePass123!",
"firstName": "John",
"lastName": "Doe",
"username": "johndoe"
}
# Get user profile
GET /api/users/profile
Authorization: Bearer your-jwt-token
# Update user profile
PUT /api/users/profile
Authorization: Bearer your-jwt-token
{
"firstName": "John",
"lastName": "Smith",
"bio": "Software developer",
"avatar": "https://example.com/avatar.jpg"
}
# Get all users (admin only)
GET /api/users
Authorization: Bearer admin-jwt-token
# Get specific user
GET /api/users/{userId}
Authorization: Bearer admin-jwt-token
# Update user (admin only)
PUT /api/users/{userId}
Authorization: Bearer admin-jwt-token
{
"role": "moderator",
"isActive": true
}
# Delete user (admin only)
DELETE /api/users/{userId}
Authorization: Bearer admin-jwt-token
# User registration
POST /api/auth/register
{
"email": "user@example.com",
"password": "SecurePass123!",
"firstName": "John",
"lastName": "Doe"
}
# User login
POST /api/auth/login
{
"email": "user@example.com",
"password": "SecurePass123!"
}
# Refresh token
POST /api/auth/refresh
{
"refreshToken": "your-refresh-token"
}
# Logout
POST /api/auth/logout
Authorization: Bearer your-jwt-token
# Get own profile
GET /api/users/profile
Authorization: Bearer your-jwt-token
# Update own profile
PUT /api/users/profile
Authorization: Bearer your-jwt-token
{
"firstName": "John",
"lastName": "Smith",
"bio": "Software developer",
"avatar": "https://example.com/avatar.jpg",
"preferences": {
"theme": "dark",
"notifications": true
}
}
# Upload avatar
POST /api/users/avatar
Authorization: Bearer your-jwt-token
Content-Type: multipart/form-data
# List all users
GET /api/users?page=1&limit=10&search=john&role=user
# Get user by ID
GET /api/users/{userId}
# Create user (admin)
POST /api/users
{
"email": "newuser@example.com",
"password": "SecurePass123!",
"firstName": "Jane",
"lastName": "Doe",
"role": "user"
}
# Update user (admin)
PUT /api/users/{userId}
{
"role": "moderator",
"isActive": true,
"permissions": ["read:all", "write:own"]
}
# Delete user (admin)
DELETE /api/users/{userId}
# Bulk operations
POST /api/users/bulk
{
"action": "activate",
"userIds": ["user1", "user2", "user3"]
}
# Send email verification
POST /api/auth/send-verification
{
"email": "user@example.com"
}
# Verify email
POST /api/auth/verify-email
{
"email": "user@example.com",
"code": "123456"
}
# Send phone verification
POST /api/auth/sms/send
{
"phone": "+1234567890"
}
# Verify phone
POST /api/auth/sms/verify
{
"phone": "+1234567890",
"code": "123456"
}
# Change password
POST /api/auth/change-password
Authorization: Bearer your-jwt-token
{
"currentPassword": "OldPassword123!",
"newPassword": "NewSecurePass123!"
}
# Forgot password
POST /api/auth/forgot-password
{
"email": "user@example.com"
}
# Reset password
POST /api/auth/reset-password
{
"email": "user@example.com",
"code": "123456",
"newPassword": "NewSecurePass123!"
}
# Enable/disable registration
AUTH_ALLOW_REGISTRATION=true
# Require email verification
AUTH_REQUIRE_EMAIL_VERIFICATION=true
# Require phone verification
AUTH_REQUIRE_PHONE_VERIFICATION=false
# Allow username registration
AUTH_ALLOW_USERNAME_REGISTRATION=true
# Minimum password length
AUTH_PASSWORD_MIN_LENGTH=8
# Enable profile features
USER_PROFILE_ENABLED=true
# Allow avatar uploads
USER_AVATAR_ENABLED=true
# Maximum avatar size (MB)
USER_AVATAR_MAX_SIZE=5
# Allowed avatar formats
USER_AVATAR_FORMATS=jpg,jpeg,png,gif
# Enable user preferences
USER_PREFERENCES_ENABLED=true
# Default user role
AUTH_DEFAULT_ROLE=user
# Available roles
AUTH_ROLES=user,moderator,admin
# Role hierarchy
AUTH_ROLE_HIERARCHY=user<moderator<admin
# Enable permission system
AUTH_PERMISSIONS_ENABLED=true
interface User {
_id: string;
email: string;
username?: string;
firstName: string;
lastName: string;
password: string;
role: string;
isActive: boolean;
emailVerified: boolean;
phoneVerified: boolean;
avatar?: string;
bio?: string;
preferences?: UserPreferences;
lastLogin?: Date;
createdAt: Date;
updatedAt: Date;
}
interface UserPreferences {
theme: 'light' | 'dark';
notifications: boolean;
language: string;
timezone: string;
[key: string]: any;
}
interface UserProfile {
_id: string;
userId: string;
bio?: string;
avatar?: string;
socialLinks?: {
twitter?: string;
linkedin?: string;
github?: string;
};
location?: string;
website?: string;
birthDate?: Date;
preferences: UserPreferences;
createdAt: Date;
updatedAt: Date;
}
import { UserService } from './modules/users/services/user.service';
const userService = new UserService();
// Create user
const user = await userService.create({
email: 'user@example.com',
password: 'SecurePass123!',
firstName: 'John',
lastName: 'Doe'
});
// Get user by ID
const user = await userService.getById('user-id');
// Update user
const updatedUser = await userService.update('user-id', {
firstName: 'John',
lastName: 'Smith'
});
// Delete user
await userService.delete('user-id');
// Search users
const users = await userService.search({
query: 'john',
role: 'user',
isActive: true,
page: 1,
limit: 10
});
import { AuthService } from './modules/auth/services/auth.service';
const authService = new AuthService();
// Register user
const result = await authService.register({
email: 'user@example.com',
password: 'SecurePass123!',
firstName: 'John',
lastName: 'Doe'
});
// Login user
const loginResult = await authService.login({
email: 'user@example.com',
password: 'SecurePass123!'
});
// Verify email
await authService.verifyEmail('user@example.com', '123456');
// Change password
await authService.changePassword('user-id', 'OldPass123!', 'NewPass123!');
# Get user statistics
GET /api/users/stats
Authorization: Bearer admin-jwt-token
# Response includes:
{
"totalUsers": 1250,
"activeUsers": 1180,
"newUsersThisMonth": 45,
"usersByRole": {
"user": 1100,
"moderator": 120,
"admin": 30
},
"verificationStats": {
"emailVerified": 1150,
"phoneVerified": 800
}
}
# Get user activity
GET /api/users/{userId}/activity
Authorization: Bearer admin-jwt-token
# Get user sessions
GET /api/users/{userId}/sessions
Authorization: Bearer admin-jwt-token
For a complete list of all user management environment variables, see the .env.example
file which includes:
The Diagramers API provides comprehensive authentication support with multiple providers and security features. Developers can enable any combination of authentication methods by simply providing the required configuration keys.
Complete OAuth 2.0 support for major platforms:
Multi-provider SMS support:
Multi-provider email support:
Extended social platform support:
# In your .env file
AUTH_INTERNAL_ENABLED=true
AUTH_INTERNAL_ALLOW_REGISTRATION=true
AUTH_INTERNAL_REQUIRE_EMAIL_VERIFICATION=true
JWT_SECRET=your-super-secret-jwt-key
# In your .env file
AUTH_OAUTH_ENABLED=true
AUTH_OAUTH_GOOGLE_ENABLED=true
AUTH_OAUTH_GOOGLE_CLIENT_ID=your-google-client-id.apps.googleusercontent.com
AUTH_OAUTH_GOOGLE_CLIENT_SECRET=your-google-client-secret
AUTH_OAUTH_GOOGLE_CALLBACK_URL=http://localhost:3000/api/auth/oauth/google/callback
# In your .env file
AUTH_SMS_ENABLED=true
AUTH_SMS_PROVIDER=twilio
AUTH_SMS_TWILIO_ACCOUNT_SID=your-twilio-account-sid
AUTH_SMS_TWILIO_AUTH_TOKEN=your-twilio-auth-token
AUTH_SMS_TWILIO_FROM_NUMBER=+1234567890
# User Registration
POST /api/auth/register
{
"email": "user@example.com",
"password": "SecurePass123!",
"name": "John Doe"
}
# User Login
POST /api/auth/login
{
"email": "user@example.com",
"password": "SecurePass123!",
"provider": "internal"
}
# Refresh Token
POST /api/auth/refresh
{
"refreshToken": "your-refresh-token"
}
# Logout
POST /api/auth/logout
Authorization: Bearer your-jwt-token
# Send Verification Code
POST /api/auth/send-verification
{
"email": "user@example.com"
}
# Verify Email
POST /api/auth/verify-email
{
"email": "user@example.com",
"code": "123456"
}
# Forgot Password
POST /api/auth/forgot-password
{
"email": "user@example.com"
}
# Reset Password
POST /api/auth/reset-password
{
"email": "user@example.com",
"code": "123456",
"newPassword": "NewSecurePass123!"
}
# Change Password
POST /api/auth/change-password
Authorization: Bearer your-jwt-token
{
"currentPassword": "OldPassword123!",
"newPassword": "NewSecurePass123!"
}
# Send SMS Code
POST /api/auth/sms/send
{
"phone": "+1234567890"
}
# Verify SMS Code
POST /api/auth/sms/verify
{
"phone": "+1234567890",
"code": "123456"
}
# Get OAuth Authorization URL
GET /api/auth/oauth/google/url
# Returns: { "authUrl": "https://accounts.google.com/oauth/authorize?..." }
# OAuth Callback (handled automatically)
GET /api/auth/oauth/google/callback?code=auth-code&state=state-value
# Begin WebAuthn Registration
POST /api/auth/webauthn/register/begin
Authorization: Bearer your-jwt-token
# Finish WebAuthn Registration
POST /api/auth/webauthn/register/finish
Authorization: Bearer your-jwt-token
{
"credential": { /* WebAuthn credential object */ }
}
# Begin WebAuthn Authentication
POST /api/auth/webauthn/login/begin
{
"email": "user@example.com"
}
# Finish WebAuthn Authentication
POST /api/auth/webauthn/login/finish
{
"email": "user@example.com",
"credential": { /* WebAuthn credential object */ }
}
# Get User Profile
GET /api/auth/profile
Authorization: Bearer your-jwt-token
# Validate Token
GET /api/auth/validate
Authorization: Bearer your-jwt-token
# Configure password requirements
AUTH_PASSWORD_MIN_LENGTH=8
AUTH_PASSWORD_REQUIRE_UPPERCASE=true
AUTH_PASSWORD_REQUIRE_LOWERCASE=true
AUTH_PASSWORD_REQUIRE_NUMBERS=true
AUTH_PASSWORD_REQUIRE_SPECIAL_CHARS=true
# General auth settings
AUTH_DEFAULT_PROVIDER=internal
AUTH_ALLOW_MULTIPLE_PROVIDERS=true
AUTH_SESSION_TIMEOUT=3600
AUTH_MAX_LOGIN_ATTEMPTS=5
AUTH_LOCKOUT_DURATION=900
# JWT token settings
JWT_SECRET=your-super-secret-jwt-key-change-this-in-production
JWT_EXPIRES_IN=1h
REFRESH_TOKEN_EXPIRES_IN=7d
AUTH_FIREBASE_ENABLED=true
AUTH_FIREBASE_PROJECT_ID=your-project-id
AUTH_FIREBASE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
AUTH_FIREBASE_CLIENT_EMAIL=firebase-adminsdk-xxxxx@your-project.iam.gserviceaccount.com
AUTH_OAUTH_GOOGLE_ENABLED=true
AUTH_OAUTH_GOOGLE_CLIENT_ID=your-client-id.apps.googleusercontent.com
AUTH_OAUTH_GOOGLE_CLIENT_SECRET=your-client-secret
AUTH_OAUTH_GOOGLE_CALLBACK_URL=http://localhost:3000/api/auth/oauth/google/callback
AUTH_SMS_ENABLED=true
AUTH_SMS_PROVIDER=twilio
AUTH_SMS_TWILIO_ACCOUNT_SID=your-account-sid
AUTH_SMS_TWILIO_AUTH_TOKEN=your-auth-token
AUTH_SMS_TWILIO_FROM_NUMBER=+1234567890
// src/modules/auth/providers/custom-auth-provider.ts
import { BaseAuthProvider } from './base-auth-provider';
export class CustomAuthProvider extends BaseAuthProvider {
async authenticate(credentials: any): Promise<any> {
// Your custom authentication logic
}
}
// src/middleware/auth-middleware.ts
export const authMiddleware = (req: Request, res: Response, next: NextFunction) => {
// Your custom authentication middleware
};
For a complete list of all authentication environment variables, see the .env.example
file which includes:
LOG_LEVEL=debug
DEBUG=auth:*
All authentication endpoints are automatically documented with Swagger. Visit /api-docs
to explore:
All generated tables automatically include:
# Run seeding
npm run seed
# Reset and reseed
npm run seed --reset
# Force reseed (skip existing data check)
npm run seed --force
// src/core/database/seeder.ts
const defaultData: SeedData = {
products: [
{
name: 'Sample Product 1',
price: 29.99,
description: 'Description for sample product 1',
category_id: 'category-id-1'
}
],
categories: [
{
name: 'Electronics',
description: 'Electronic devices and gadgets',
slug: 'electronics'
}
]
};
// Enable plugins in main.ts
import { AuditPlugin } from './plugins/audit';
import { EmailPlugin } from './plugins/email';
const app = new Application();
app.use(new AuditPlugin());
app.use(new EmailPlugin());
// Socket event handling
import { SocketManager } from './core/server/socket-manager';
const socketManager = new SocketManager(server);
// Handle custom events
socketManager.on('product:updated', (data) => {
// Broadcast to all clients
socketManager.broadcast('product:updated', data);
});
// Frontend connection
const socket = io('http://localhost:3000');
socket.on('product:updated', (product) => {
console.log('Product updated:', product);
});
/api-docs
The Diagramers API includes comprehensive Odoo ERP integration with the following endpoints:
POST /api/odoo/connect # Initialize Odoo connection
GET /api/odoo/status # Get connection status
GET /api/odoo/customers # Get all customers
GET /api/odoo/customers/:id # Get customer by ID
POST /api/odoo/customers # Create customer
PUT /api/odoo/customers/:id # Update customer
GET /api/odoo/leads # Get all leads
GET /api/odoo/leads/:id # Get lead by ID
POST /api/odoo/leads # Create lead
PUT /api/odoo/leads/:id # Update lead
GET /api/odoo/opportunities # Get all opportunities
GET /api/odoo/products # Get all products
GET /api/odoo/orders # Get all orders
GET /api/odoo/invoices # Get all invoices
// Initialize Odoo connection
const response = await fetch('/api/odoo/connect', {
method: 'POST'
});
// Get customers with filters
const customers = await fetch('/api/odoo/customers?limit=50&filters[is_company]=true');
// Create a new lead
const leadData = {
name: 'New Sales Lead',
partner_name: 'ABC Company',
contact_name: 'John Doe',
email_from: 'john@abc.com',
phone: '+1234567890',
type: 'lead',
description: 'Interested in our product'
};
const newLead = await fetch('/api/odoo/leads', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(leadData)
});
For complete Odoo integration documentation, see ODOO_MODULE.md.
/**
* @openapi
* /api/products:
* get:
* summary: Get all products
* tags: [Products]
* responses:
* 200:
* description: List of products
* content:
* application/json:
* schema:
* type: array
* items:
* $ref: '#/components/schemas/Product'
*/
# Run tests
npm test
# Run with coverage
npm run test:coverage
# Run specific test file
npm test -- --testNamePattern="ProductService"
# Run integration tests
npm run test:integration
# Test specific endpoint
npm run test:integration -- --grep "Products API"
# Build for production
npm run build:prod
# Start production server
npm run start:prod
FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
RUN npm run build:prod
EXPOSE 3000
CMD ["npm", "run", "start:prod"]
# Production environment
NODE_ENV=production
DATABASE_URL=mongodb://prod-server:27017/my-api
JWT_SECRET=secure-production-secret
import { logger } from './core/logging';
logger.info('Application started');
logger.error('Database connection failed', error);
logger.warn('Rate limit exceeded', { ip: req.ip });
# Health endpoint
GET /health
# Database health
GET /health/database
# Detailed system info
GET /health/system
We welcome contributions! Please see our Contributing Guide for details.
MIT License - see LICENSE file for details.
FAQs
Diagramers API - A comprehensive Node.js API template with TypeScript, Firebase Functions, and Socket.io
The npm package @diagramers/api receives a total of 17 weekly downloads. As such, @diagramers/api popularity was classified as not popular.
We found that @diagramers/api demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.ย It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.