diff --git a/integrations/authentication.mdx b/integrations/authentication.mdx new file mode 100644 index 0000000..6f0765f --- /dev/null +++ b/integrations/authentication.mdx @@ -0,0 +1,401 @@ +--- +title: 'Authentication' +description: 'Integrate with Google OAuth and GitHub for secure user authentication' +--- + +## Authentication Integrations + +Secure your Astrio applications with Google OAuth and GitHub authentication. Simple, reliable, and trusted authentication methods that your users already know and trust. + +## Supported Providers + + + + Most popular social login with extensive user base + + + Perfect for developer-focused applications + + + +## Google OAuth + +### Why Google OAuth? + +Google OAuth is the most popular social login provider, offering: +- **Wide User Base** - Billions of users worldwide +- **Trusted Brand** - Users trust Google with their data +- **Rich Profile Data** - Access to email, name, profile picture +- **Easy Setup** - Simple configuration process + +### Setup Process + + + + Go to Google Cloud Console and create OAuth 2.0 credentials + + + Set required scopes: email, profile, openid + + + Enter your Client ID and Client Secret in Astrio dashboard + + + Verify the authentication flow works correctly + + + +### Google Cloud Console Setup + +1. **Navigate to Google Cloud Console** + - Go to [console.cloud.google.com](https://console.cloud.google.com) + - Create a new project or select existing one + +2. **Enable Google+ API** + - Go to "APIs & Services" → "Library" + - Search for "Google+ API" and enable it + +3. **Create OAuth Credentials** + - Go to "APIs & Services" → "Credentials" + - Click "Create Credentials" → "OAuth 2.0 Client IDs" + - Choose "Web application" as application type + +4. **Configure OAuth Consent Screen** + - Set app name, user support email, and developer contact + - Add authorized domains + - Configure scopes (email, profile, openid) + +### Configuration + +**Required Credentials:** +```javascript +// Google OAuth configuration +const googleConfig = { + clientId: 'your-google-client-id.apps.googleusercontent.com', + clientSecret: 'your-google-client-secret', + redirectUri: 'https://your-app.astrio.build/auth/google/callback', + scopes: ['email', 'profile', 'openid'] +} +``` + +**Environment Variables:** +```bash +GOOGLE_CLIENT_ID=your-google-client-id.apps.googleusercontent.com +GOOGLE_CLIENT_SECRET=your-google-client-secret +GOOGLE_REDIRECT_URI=https://your-app.astrio.build/auth/google/callback +``` + +### User Data Available + +When users authenticate with Google, you get access to: + +**Profile Information:** +- **Email Address** - Primary email from Google account +- **Full Name** - User's first and last name +- **Profile Picture** - User's Google profile photo +- **Locale** - User's language and region preferences + +**Account Details:** +- **Google Account ID** - Unique identifier for the user +- **Email Verification** - Whether email is verified +- **Account Type** - Personal or Google Workspace account + +## GitHub OAuth + +### Why GitHub OAuth? + +GitHub OAuth is ideal for: +- **Developer Tools** - Perfect for developer-focused applications +- **Open Source Projects** - Connect with the open source community +- **Technical Users** - Developers already have GitHub accounts +- **Repository Access** - Access to user's public repositories + +### Setup Process + + + + Go to GitHub Developer Settings and create a new OAuth App + + + Set required scopes: user:email, read:user + + + Enter your Client ID and Client Secret in Astrio dashboard + + + Verify the authentication flow works correctly + + + +### GitHub Developer Settings + +1. **Navigate to GitHub Settings** + - Go to GitHub.com → Settings → Developer settings + - Click "OAuth Apps" → "New OAuth App" + +2. **Configure OAuth App** + - **Application name**: Your app name + - **Homepage URL**: Your app's homepage + - **Authorization callback URL**: `https://your-app.astrio.build/auth/github/callback` + +3. **Set Permissions** + - **User permissions**: Email addresses (read-only) + - **User permissions**: Profile (read-only) + +### Configuration + +**Required Credentials:** +```javascript +// GitHub OAuth configuration +{ + clientId: "your-github-client-id", + clientSecret: "your-github-client-secret", + redirectUri: "https://your-app.astrio.build/auth/github/callback", + scopes: ["user:email", "read:user"] +} +``` + +**Environment Variables:** +```bash +GITHUB_CLIENT_ID=your-github-client-id +GITHUB_CLIENT_SECRET=your-github-client-secret +GITHUB_REDIRECT_URI=https://your-app.astrio.build/auth/github/callback +``` + +### Available Scopes + +**Basic Scopes:** +- **user:email** - Access to user's email addresses +- **read:user** - Read access to user profile + +**Advanced Scopes (use carefully):** +- **repo** - Full repository access (public and private) +- **workflow** - GitHub Actions workflow access +- **admin:org** - Organization administration access + +### User Data Available + +When users authenticate with GitHub, you get access to: + +**Profile Information:** +- **Username** - GitHub username +- **Full Name** - User's real name +- **Email Addresses** - All email addresses associated with account +- **Profile Picture** - User's GitHub avatar +- **Bio** - User's GitHub bio + +**Account Details:** +- **GitHub ID** - Unique numeric identifier +- **Account Type** - User or Organization +- **Public Repositories** - List of public repositories +- **Followers/Following** - Social connections + +## Authentication Flow + +### OAuth 2.0 Flow + +The authentication process follows the standard OAuth 2.0 authorization code flow: + + + + User clicks "Sign in with Google" or "Sign in with GitHub" + + + User is redirected to Google/GitHub authorization page + + + User grants permission to your application + + + Provider redirects back with authorization code + + + Astrio exchanges code for access token + + + Fetch user profile using access token + + + Create user session and redirect to app + + + +### Security Features + + + + JWT tokens with automatic refresh + + + Prevent CSRF attacks with state parameter + + + All authentication over secure connections + + + Secure server-side token storage + + + +## User Management + +### User Profiles +Comprehensive user profile management: + +**Profile Features:** +- **Automatic Profile Creation** - Profiles created on first login +- **Profile Updates** - Sync profile data on each login +- **Custom Fields** - Add custom user attributes +- **Profile Pictures** - Automatic avatar from provider + +### Session Management +Secure session handling and management: + +**Session Features:** +- **JWT Tokens** - Secure JSON Web Tokens for authentication +- **Refresh Tokens** - Automatic token refresh for long sessions +- **Session Timeout** - Configurable session expiration +- **Multi-Device Support** - Login from multiple devices + +## Integration Examples + +### React Component Example +```jsx +import { useAuth } from '@astrio/auth'; + +function LoginButtons() { + const { login, logout, user } = useAuth(); + + if (user) { + return ( +
+

Welcome, {user.name}!

+ Profile + +
+ ); + } + + return ( +
+ + +
+ ); +} +``` + +### API Authentication +```javascript +// Protected API route +export default async function handler(req, res) { + // Verify authentication token + const user = await verifyToken(req.headers.authorization); + + if (!user) { + return res.status(401).json({ error: 'Unauthorized' }); + } + + // Handle authenticated request + const data = await getProtectedData(user.id); + res.json(data); +} +``` + +### User Data Access +```javascript +// Access user data in your application +const user = await getCurrentUser(); + +console.log('User ID:', user.id); +console.log('Email:', user.email); +console.log('Name:', user.name); +console.log('Avatar:', user.avatar); +console.log('Provider:', user.provider); // 'google' or 'github' +``` + +## Getting Started + +### Quick Setup +Get authentication working in minutes: + + + + Select Google OAuth or GitHub OAuth + + + Set up OAuth application with your chosen provider + + + Add authentication integration with your credentials + + + Verify login and logout functionality + + + +### Best Practices + + + + Google OAuth has the broadest user compatibility + + + Add GitHub for developer-focused features + + + Implement proper error handling for auth failures + + + Provide clear feedback during authentication process + + + +### Migration Guide +Migrating from existing authentication system? + + +Our authentication experts can help you migrate from any authentication system to Astrio. Contact support@astrio.build for migration assistance. + + + +Start with Google OAuth for the easiest setup and broadest user compatibility. Add GitHub OAuth later for developer-focused features. + + + +Always implement proper error handling and user feedback for authentication failures. Never store sensitive authentication data in client-side code. + diff --git a/integrations/databases.mdx b/integrations/databases.mdx new file mode 100644 index 0000000..ba4a5ab --- /dev/null +++ b/integrations/databases.mdx @@ -0,0 +1,386 @@ +--- +title: 'Databases' +description: 'Connect to Supabase for powerful database functionality with real-time features' +--- + +## Database Integration + +Astrio provides seamless integration with Supabase, the open-source Firebase alternative built on PostgreSQL. Get a powerful, scalable database with real-time features, authentication, and storage all in one platform. + +## Why Supabase? + + + + Built on the world's most advanced open-source database + + + Live data updates with subscriptions + + + User authentication and authorization + + + Secure file uploads and management + + + +## Supabase Integration + +### Getting Started with Supabase + + + + Sign up at supabase.com and create a new project + + + Copy your project URL and anon/public key from the API settings + + + Add Supabase integration with your project details + + + Set up your database schema in Supabase dashboard + + + +### Project Configuration + +**Required Credentials:** +```javascript +// Supabase configuration +const supabaseConfig = { + url: 'https://your-project.supabase.co', + anonKey: 'your-anon-key', + serviceRoleKey: 'your-service-role-key' // For admin operations +} +``` + +**Environment Variables:** +```bash +SUPABASE_URL=https://your-project.supabase.co +SUPABASE_ANON_KEY=your-anon-key +SUPABASE_SERVICE_ROLE_KEY=your-service-role-key +``` + +## Database Features + +### PostgreSQL Database +Leverage the full power of PostgreSQL with Supabase: + +**SQL Support:** +- **Full SQL** - Complete PostgreSQL functionality +- **JSON Data Types** - Store and query JSON efficiently +- **Geographic Data** - PostGIS support for location features +- **Extensions** - Rich ecosystem of database extensions + +**Example Queries:** +```sql +-- Create a users table +CREATE TABLE users ( + id UUID DEFAULT gen_random_uuid() PRIMARY KEY, + email TEXT UNIQUE NOT NULL, + name TEXT, + created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() +); + +-- Insert data +INSERT INTO users (email, name) VALUES ('john@example.com', 'John Doe'); + +-- Query with JSON +SELECT * FROM users WHERE metadata->>'preferences' = 'dark_mode'; +``` + +### Real-time Subscriptions +Get live updates when data changes: + +```javascript +// Subscribe to table changes +const subscription = supabase + .from('users') + .on('INSERT', payload => { + console.log('New user:', payload.new) + }) + .on('UPDATE', payload => { + console.log('User updated:', payload.new) + }) + .on('DELETE', payload => { + console.log('User deleted:', payload.old) + }) + .subscribe() +``` + +**Real-time Features:** +- **Live Updates** - Instant data synchronization +- **Filtered Subscriptions** - Subscribe to specific data changes +- **Presence** - Track user online status +- **Broadcasting** - Send messages to connected clients + +### Row Level Security (RLS) +Secure your data with fine-grained access control: + +```sql +-- Enable RLS on users table +ALTER TABLE users ENABLE ROW LEVEL SECURITY; + +-- Policy for users to see only their own data +CREATE POLICY "Users can view own data" ON users + FOR SELECT USING (auth.uid() = id); + +-- Policy for public read access to profiles +CREATE POLICY "Public profiles are viewable" ON users + FOR SELECT USING (is_public = true); +``` + +**Security Features:** +- **User-Based Access** - Control access by authenticated user +- **Role-Based Policies** - Different permissions for different roles +- **Public/Private Data** - Mix public and private data in same table +- **Automatic Filtering** - Queries automatically filtered by policies + +## Authentication Integration + +### Built-in Authentication +Supabase provides comprehensive authentication out of the box: + +**Supported Providers:** +- **Email/Password** - Traditional email authentication +- **Magic Links** - Passwordless email authentication +- **Phone Authentication** - SMS-based verification +- **OAuth Providers** - Google, GitHub, and more + +**User Management:** +```javascript +// Sign up a new user +const { user, error } = await supabase.auth.signUp({ + email: 'user@example.com', + password: 'secure-password' +}) + +// Sign in existing user +const { user, error } = await supabase.auth.signIn({ + email: 'user@example.com', + password: 'secure-password' +}) + +// Get current user +const { user } = await supabase.auth.getUser() +``` + +## File Storage + +### Supabase Storage +Store and serve files securely: + +**Storage Features:** +- **File Uploads** - Drag-and-drop file uploads +- **Image Transformations** - Resize, crop, and optimize images +- **CDN Delivery** - Fast global file delivery +- **Access Control** - Secure file access with RLS + +**File Operations:** +```javascript +// Upload a file +const { data, error } = await supabase.storage + .from('avatars') + .upload('user-avatar.jpg', file) + +// Get public URL +const { data } = supabase.storage + .from('avatars') + .getPublicUrl('user-avatar.jpg') + +// Download a file +const { data, error } = await supabase.storage + .from('documents') + .download('document.pdf') +``` + +## Database Management + +### Schema Management +Manage your database schema through Supabase: + +**Table Creation:** +```sql +-- Example: E-commerce schema +CREATE TABLE products ( + id UUID DEFAULT gen_random_uuid() PRIMARY KEY, + name TEXT NOT NULL, + description TEXT, + price DECIMAL(10,2) NOT NULL, + category TEXT, + image_url TEXT, + created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() +); + +CREATE TABLE orders ( + id UUID DEFAULT gen_random_uuid() PRIMARY KEY, + user_id UUID REFERENCES users(id), + total_amount DECIMAL(10,2) NOT NULL, + status TEXT DEFAULT 'pending', + created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() +); +``` + +**Indexes and Performance:** +```sql +-- Create indexes for better performance +CREATE INDEX idx_products_category ON products(category); +CREATE INDEX idx_orders_user_id ON orders(user_id); +CREATE INDEX idx_orders_status ON orders(status); +``` + +### Data Migration +Import and export data easily: + +**CSV Import:** +```sql +-- Import data from CSV +COPY products(name, description, price, category) +FROM '/path/to/products.csv' +WITH (FORMAT csv, HEADER true); +``` + +**Data Export:** +```sql +-- Export data to CSV +COPY products TO '/path/to/export.csv' +WITH (FORMAT csv, HEADER true); +``` + +## Security and Compliance + +### Data Protection +Enterprise-grade security for your data: + + + + AES-256 encryption for data at rest and in transit + + + Row Level Security and role-based permissions + + + Complete audit trail of all database operations + + + Automatic daily backups with point-in-time recovery + + + +### Compliance +Meet regulatory requirements: + +- **GDPR Compliance** - European data protection regulations +- **SOC 2 Type II** - Security and availability controls +- **HIPAA Ready** - Healthcare data protection (Enterprise) +- **ISO 27001** - Information security management + +## Performance Optimization + +### Query Optimization +Optimize your database performance: + +**Best Practices:** +- **Use Indexes** - Create indexes on frequently queried columns +- **Limit Results** - Use LIMIT to restrict result sets +- **Select Specific Columns** - Avoid SELECT * for large tables +- **Use Pagination** - Implement cursor-based pagination + +**Performance Monitoring:** +```sql +-- Check slow queries +SELECT query, mean_time, calls +FROM pg_stat_statements +ORDER BY mean_time DESC +LIMIT 10; +``` + +### Connection Pooling +Efficient database connection management: + +- **Automatic Pooling** - Supabase handles connection pooling +- **Connection Limits** - Prevents overwhelming the database +- **Health Checks** - Monitors connection health +- **Load Balancing** - Distributes queries efficiently + +## Getting Started + +### Quick Setup +Get Supabase connected in minutes: + + + + Sign up and create a new Supabase project + + + Copy your project URL and API keys + + + Add Supabase integration with your credentials + + + Set up your database tables and relationships + + + +### Example Application +Build a simple user management system: + +```javascript +// Create a user +const { data, error } = await supabase + .from('users') + .insert([ + { + email: 'john@example.com', + name: 'John Doe', + metadata: { preferences: { theme: 'dark' } } + } + ]) + +// Query users with real-time updates +const { data, error } = await supabase + .from('users') + .select('*') + .order('created_at', { ascending: false }) +``` + +### Migration Support +Need help migrating your existing database? + + +Our database experts can help you migrate from any database system to Supabase. Contact support@astrio.build for migration assistance. + + + +Start with the Supabase dashboard to explore your data and test queries before integrating with Astrio. + + + +Always test your Row Level Security policies thoroughly to ensure data access is properly restricted. + diff --git a/integrations/overview.mdx b/integrations/overview.mdx index 5bac443..06c3a3b 100644 --- a/integrations/overview.mdx +++ b/integrations/overview.mdx @@ -1,87 +1,65 @@ --- title: 'Overview' -description: 'Connect Astrio with your favorite tools and services to build powerful applications' +description: 'Connect Astrio with essential tools and services to build powerful applications' --- -## Seamless Connections +## Essential Integrations -Astrio integrates with hundreds of popular services and APIs, allowing you to build feature-rich applications without starting from scratch. Connect your existing tools and data sources with just a few clicks. +Astrio integrates with the most essential services you need to build production applications. Start with these proven, reliable integrations and focus on building your core product. + +## Integration Categories - PostgreSQL, MySQL, MongoDB, Supabase, and more + Supabase - PostgreSQL with real-time features - Google, GitHub, Auth0, Firebase Auth, and custom providers + Google OAuth and GitHub authentication - Stripe, PayPal, Square, and other payment processors + Stripe - Secure payment processing - REST APIs, GraphQL, webhooks, and custom integrations + REST APIs, GraphQL, and webhooks -## Popular Integrations +## Supported Integrations -### 💾 Data & Storage +### Database
-
-
- PG -
- PostgreSQL -
S
Supabase
-
-
- M -
- MongoDB -
-
-
- F -
- Firebase -
-
-
- R -
- Redis -
-
-
- A -
- Airtable -
-### 🔐 Authentication Providers +**Why Supabase?** +- **PostgreSQL Backend** - Built on the world's most advanced database +- **Real-time Features** - Live data updates with subscriptions +- **Built-in Auth** - User authentication and authorization +- **File Storage** - Secure file uploads and management + +### Authentication
@@ -96,33 +74,15 @@ Astrio integrates with hundreds of popular services and APIs, allowing you to bu
GitHub
-
-
- M -
- Microsoft -
-
-
- A -
- Auth0 -
-
-
- O -
- Okta -
-
-
- D -
- Discord -
-### 💳 Payment Processing +**Authentication Benefits:** +- **Trusted Providers** - Users trust Google and GitHub +- **Easy Setup** - Simple OAuth configuration +- **Rich Profile Data** - Access to email, name, profile picture +- **Developer Friendly** - Perfect for technical applications + +### Payments
@@ -131,26 +91,14 @@ Astrio integrates with hundreds of popular services and APIs, allowing you to bu
Stripe
-
-
- P -
- PayPal -
-
-
- S -
- Square -
-
-
- R -
- Razorpay -
+**Payment Features:** +- **Global Reach** - Accept payments from customers worldwide +- **Multiple Methods** - Credit cards, digital wallets, bank transfers +- **Subscription Billing** - Recurring payments and subscriptions +- **Advanced Security** - PCI DSS compliant with fraud protection + ## Integration Categories @@ -204,7 +152,7 @@ Astrio integrates with hundreds of popular services and APIs, allowing you to bu - Explore our integration marketplace or search for specific services + Explore our supported integrations or search for specific services Authenticate with your service using OAuth or API keys @@ -242,34 +190,34 @@ Connect to GraphQL APIs with full query support: - Subscription support - Type-safe data handling -## Enterprise Integrations +## Future Integrations -For enterprise customers, we offer: +As we grow, we plan to add support for: - Build dedicated connectors for your internal systems + PostgreSQL, MySQL, MongoDB, and Redis - Connect to services behind your firewall + Facebook, Twitter, and custom providers - Single sign-on with your identity provider + PayPal, Square, and regional processors - Branded API endpoints for your customers + SSO, SAML, and enterprise integrations @@ -282,5 +230,5 @@ Our integration team is here to help! Contact support@astrio.build for custom in -Most integrations can be set up in under 5 minutes using our pre-built connectors and guided setup wizard. +Start with our core integrations (Supabase, Google/GitHub auth, Stripe) to get your application up and running quickly. Add custom integrations as needed. \ No newline at end of file diff --git a/integrations/payments.mdx b/integrations/payments.mdx new file mode 100644 index 0000000..7fae4a7 --- /dev/null +++ b/integrations/payments.mdx @@ -0,0 +1,431 @@ +--- +title: 'Payments' +description: 'Integrate Stripe for secure payment processing with credit cards, digital wallets, and subscriptions' +--- + +## Payment Integration + +Accept payments securely with Stripe, the world's leading payment processor. Support credit cards, digital wallets, and subscription billing with a simple, reliable integration. + +## Why Stripe? + + + + Accept payments from customers worldwide + + + Excellent documentation and developer tools + + + PCI DSS compliant with advanced fraud protection + + + Simple, transparent pricing with no hidden fees + + + +## Stripe Integration + +### Getting Started with Stripe + + + + Sign up for a Stripe account at stripe.com + + + Obtain your publishable and secret keys from Stripe Dashboard + + + Add Stripe integration with your API keys + + + Use Stripe's test mode to verify integration + + + +### Stripe Dashboard Setup + +1. **Create Stripe Account** + - Go to [stripe.com](https://stripe.com) and sign up + - Complete your business profile + - Verify your identity for account activation + +2. **Get API Keys** + - Navigate to Developers → API keys + - Copy your publishable key and secret key + - Keep your secret key secure and never expose it + +3. **Configure Webhooks** + - Go to Developers → Webhooks + - Add endpoint: `https://your-app.astrio.build/webhooks/stripe` + - Select events: `payment_intent.succeeded`, `invoice.payment_succeeded` + +### Configuration + +**Required Credentials:** +```javascript +// Stripe configuration +const stripeConfig = { + publishableKey: 'pk_test_your_publishable_key', + secretKey: 'sk_test_your_secret_key', + webhookSecret: 'whsec_your_webhook_secret', + currency: 'usd', + paymentMethods: ['card', 'apple_pay', 'google_pay'] +} +``` + +**Environment Variables:** +```bash +STRIPE_PUBLISHABLE_KEY=pk_test_your_publishable_key +STRIPE_SECRET_KEY=sk_test_your_secret_key +STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret +``` + +## Payment Methods + +### Credit and Debit Cards +Process card payments with advanced security features. + +**Supported Cards:** +- **Visa** - Global credit and debit card network +- **Mastercard** - Worldwide payment processing +- **American Express** - Premium card network +- **Discover** - US-based payment network +- **JCB** - Japanese card network +- **UnionPay** - Chinese payment network + +**Security Features:** +- **PCI DSS Compliance** - Industry-standard security +- **Tokenization** - Secure card data storage +- **3D Secure** - Additional authentication layer +- **Fraud Detection** - Real-time fraud monitoring + +### Digital Wallets +Modern payment methods for mobile-first users. + +**Apple Pay** +- **iOS Integration** - Native iOS payment experience +- **Touch ID/Face ID** - Biometric authentication +- **Wallet App** - Store cards in Apple Wallet +- **Safari Support** - Web payments in Safari + +**Google Pay** +- **Android Integration** - Native Android payment experience +- **Chrome Support** - Web payments in Chrome +- **Contactless** - NFC payment support +- **Rewards** - Integration with loyalty programs + +### Bank Transfers +Direct bank-to-bank payment processing. + +**ACH (Automated Clearing House)** +- **US Bank Transfers** - Direct bank account debits +- **Low Fees** - Cost-effective for large transactions +- **Settlement Time** - 1-3 business days +- **Recurring Payments** - Subscription billing support + +**SEPA (Single Euro Payments Area)** +- **European Transfers** - Eurozone bank transfers +- **Fast Settlement** - Same-day or next-day processing +- **Low Costs** - Competitive transfer fees +- **Wide Coverage** - 36 European countries + +## Subscription and Recurring Billing + +### Subscription Management +Handle recurring payments and subscription lifecycles. + +**Subscription Features:** +- **Flexible Billing** - Monthly, yearly, or custom intervals +- **Trial Periods** - Free trial with automatic conversion +- **Proration** - Automatic billing adjustments +- **Dunning Management** - Failed payment retry logic + +**Implementation Example:** +```javascript +// Create subscription +const subscription = await stripe.subscriptions.create({ + customer: customerId, + items: [{ price: 'price_monthly_plan' }], + trial_period_days: 14, + payment_behavior: 'default_incomplete', + expand: ['latest_invoice.payment_intent'] +}); +``` + +### Usage-Based Billing +Charge customers based on actual usage. + +**Metered Billing:** +- **API Calls** - Charge per API request +- **Storage Usage** - Charge per GB stored +- **User Count** - Charge per active user +- **Feature Usage** - Charge per feature used + +## E-commerce Features + +### Shopping Cart Integration +Complete e-commerce payment processing. + +**Cart Features:** +- **Product Management** - Add, remove, and update items +- **Tax Calculation** - Automatic tax computation +- **Shipping Options** - Multiple shipping methods +- **Discount Codes** - Coupon and promotion support + +### Order Management +Comprehensive order processing and fulfillment. + +**Order Workflow:** +1. **Order Creation** - Customer places order +2. **Payment Processing** - Secure payment collection +3. **Order Confirmation** - Email confirmation sent +4. **Fulfillment** - Order processing and shipping +5. **Delivery Tracking** - Real-time delivery updates + +## Security and Compliance + +### Payment Security +Enterprise-grade security for payment processing. + + + + Industry-standard payment security + + + End-to-end data encryption + + + Advanced fraud detection systems + + + Secure card data storage + + + +### Compliance Requirements +Meet regulatory requirements for payment processing. + +**Global Compliance:** +- **GDPR** - European data protection +- **PSD2** - European payment services directive +- **SOX** - Sarbanes-Oxley compliance +- **PCI DSS** - Payment card industry standards + +## Analytics and Reporting + +### Payment Analytics +Comprehensive insights into payment performance. + +**Key Metrics:** +- **Transaction Volume** - Total payment volume +- **Success Rate** - Percentage of successful payments +- **Average Order Value** - Mean transaction amount +- **Payment Method Distribution** - Usage by payment type + +### Financial Reporting +Detailed financial reports and reconciliation. + +**Report Types:** +- **Daily Settlements** - Daily payment summaries +- **Monthly Statements** - Comprehensive monthly reports +- **Tax Reports** - Tax calculation and reporting +- **Reconciliation** - Match payments with orders + +## Webhook Integration + +### Payment Webhooks +Real-time payment event notifications. + +**Common Webhook Events:** +```javascript +// Payment webhook events +const webhookEvents = { + 'payment_intent.succeeded': 'Payment completed successfully', + 'payment_intent.payment_failed': 'Payment failed', + 'invoice.payment_succeeded': 'Subscription payment received', + 'customer.subscription.created': 'New subscription started', + 'charge.dispute.created': 'Payment dispute filed' +} +``` + +**Webhook Security:** +- **Signature Verification** - Verify webhook authenticity +- **Idempotency** - Prevent duplicate processing +- **Retry Logic** - Handle webhook delivery failures +- **Event Logging** - Complete audit trail + +## Testing and Development + +### Test Mode +Safe testing environment for payment integration. + +**Test Features:** +- **Test Cards** - Use provided test card numbers +- **Test Accounts** - Separate test merchant accounts +- **Simulated Responses** - Test various payment scenarios +- **No Real Charges** - Zero risk testing environment + +**Test Card Numbers:** +```bash +# Stripe test cards +Visa: 4242424242424242 +Mastercard: 5555555555554444 +American Express: 378282246310005 + +# Test scenarios +Declined: 4000000000000002 +Insufficient funds: 4000000000009995 +Expired card: 4000000000000069 +``` + +## Integration Examples + +### React Component Example +```jsx +import { useStripe, useElements, CardElement } from '@stripe/react-stripe-js'; + +function PaymentForm() { + const stripe = useStripe(); + const elements = useElements(); + + const handleSubmit = async (event) => { + event.preventDefault(); + + if (!stripe || !elements) { + return; + } + + const { error, paymentMethod } = await stripe.createPaymentMethod({ + type: 'card', + card: elements.getElement(CardElement), + }); + + if (error) { + console.log('[error]', error); + } else { + // Send paymentMethod.id to your server + console.log('[PaymentMethod]', paymentMethod); + } + }; + + return ( +
+ + + + ); +} +``` + +### Server-Side Payment Processing +```javascript +// Create payment intent +const paymentIntent = await stripe.paymentIntents.create({ + amount: 2000, // $20.00 + currency: 'usd', + customer: customerId, + metadata: { + order_id: 'order_123' + } +}); + +// Confirm payment +const paymentIntent = await stripe.paymentIntents.confirm( + 'pi_1234567890', + { + payment_method: 'pm_1234567890' + } +); +``` + +## Getting Started + +### Quick Setup +Get Stripe payments working in minutes: + + + + Sign up for a Stripe account + + + Obtain your publishable and secret keys + + + Add Stripe integration to your Astrio app + + + Use test mode to verify everything works + + + +### Best Practices +Optimize your Stripe integration: + + + + Always use HTTPS and secure API keys + + + Implement comprehensive error handling + + + Provide clear payment feedback + + + Test thoroughly in test mode + + + +### Migration Support +Moving from another payment system? + + +Our payment experts can help you migrate from any payment processor to Stripe. Contact support@astrio.build for migration assistance. + + + +Start with Stripe's test mode to build and test your integration before going live. Use the provided test card numbers for safe testing. + + + +Never store sensitive payment data like credit card numbers in your application. Always use Stripe's tokenization and secure payment processing. + diff --git a/integrations/third-parties.mdx b/integrations/third-parties.mdx new file mode 100644 index 0000000..664efeb --- /dev/null +++ b/integrations/third-parties.mdx @@ -0,0 +1,641 @@ +--- +title: 'Third-Party Integrations' +description: 'Connect to any REST API, GraphQL service, or custom webhook for unlimited integration possibilities' +--- + +## Third-Party API Integrations + +Connect Astrio with any external service through REST APIs, GraphQL, webhooks, and custom integrations. Build powerful applications that leverage the entire ecosystem of third-party services. + +## Integration Types + + + + Connect to any RESTful API service + + + Modern GraphQL API integrations + + + Real-time event-driven integrations + + + Build custom integration logic + + + +## REST API Integration + +### Visual API Builder +Connect to REST APIs without writing code using our visual interface. + + + + Enter the API base URL and authentication details + + + Set up GET, POST, PUT, DELETE requests + + + Define how API responses map to your application + + + Verify the connection and data flow + + + +### Authentication Methods +Support for all major API authentication types: + +**API Key Authentication:** +```javascript +// API Key in headers +{ + "Authorization": "Bearer your-api-key", + "X-API-Key": "your-api-key" +} + +// API Key in query parameters +https://api.example.com/data?api_key=your-api-key +``` + +**OAuth 2.0:** +```javascript +// OAuth 2.0 flow +const oauthConfig = { + clientId: 'your-client-id', + clientSecret: 'your-client-secret', + authorizationUrl: 'https://api.example.com/oauth/authorize', + tokenUrl: 'https://api.example.com/oauth/token', + scopes: ['read', 'write'] +} +``` + +**Basic Authentication:** +```javascript +// Username and password +const credentials = btoa('username:password'); +headers: { + 'Authorization': `Basic ${credentials}` +} +``` + +### Request Configuration +Flexible request setup for any API endpoint. + +**HTTP Methods:** +- **GET** - Retrieve data from the API +- **POST** - Create new resources +- **PUT** - Update existing resources +- **PATCH** - Partial resource updates +- **DELETE** - Remove resources + +**Request Headers:** +```javascript +// Common headers +{ + 'Content-Type': 'application/json', + 'Accept': 'application/json', + 'User-Agent': 'Astrio-Integration/1.0', + 'Authorization': 'Bearer token' +} +``` + +**Request Body:** +```javascript +// JSON payload +{ + "name": "John Doe", + "email": "john@example.com", + "age": 30 +} + +// Form data +{ + "name": "John Doe", + "file": "base64-encoded-file" +} +``` + +## GraphQL Integration + +### GraphQL Schema Introspection +Automatically discover and integrate with GraphQL APIs. + +**Schema Discovery:** +```graphql +# Introspection query +query IntrospectionQuery { + __schema { + types { + name + fields { + name + type { + name + } + } + } + } +} +``` + +**Query Builder:** +- **Visual Query Builder** - Drag-and-drop interface for building queries +- **Schema Explorer** - Browse available types and fields +- **Query Validation** - Real-time query validation +- **Response Preview** - See query results before saving + +### GraphQL Features +Advanced GraphQL integration capabilities. + + + + Fetch data with complex queries + + + Create, update, and delete data + + + Real-time data updates + + + Reusable query components + + + +**Example GraphQL Integration:** +```graphql +# User query with fragments +fragment UserFields on User { + id + name + email + profile { + avatar + bio + } +} + +query GetUser($id: ID!) { + user(id: $id) { + ...UserFields + posts { + id + title + content + } + } +} +``` + +## Webhook Integration + +### Incoming Webhooks +Receive real-time data from external services. + +**Webhook Setup:** +```javascript +// Webhook endpoint configuration +{ + endpoint: '/webhooks/external-service', + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'X-Webhook-Secret': 'your-secret' + }, + validation: 'signature' +} +``` + +**Webhook Security:** +- **Signature Verification** - Verify webhook authenticity +- **Secret Validation** - Validate webhook secrets +- **IP Whitelisting** - Restrict webhook sources +- **Rate Limiting** - Prevent webhook abuse + +### Outgoing Webhooks +Send data to external services when events occur. + +**Event Triggers:** +```javascript +// Trigger webhook on user registration +{ + event: 'user.created', + webhook: 'https://external-service.com/webhook', + payload: { + userId: '{{user.id}}', + email: '{{user.email}}', + timestamp: '{{timestamp}}' + } +} +``` + +**Webhook Retry Logic:** +- **Exponential Backoff** - Smart retry with increasing delays +- **Maximum Retries** - Configurable retry limits +- **Dead Letter Queue** - Store failed webhooks for review +- **Success Monitoring** - Track webhook delivery success + +## Popular Third-Party Services + +### Communication Services + +**Slack Integration:** +```javascript +// Send message to Slack channel +{ + method: 'POST', + url: 'https://hooks.slack.com/services/YOUR/WEBHOOK/URL', + body: { + text: 'New user registered: {{user.name}}', + channel: '#notifications' + } +} +``` + +**Discord Webhooks:** +```javascript +// Discord webhook configuration +{ + url: 'https://discord.com/api/webhooks/YOUR/WEBHOOK', + content: 'New order received: ${{order.total}}', + embeds: [{ + title: 'Order Details', + description: 'Order #{{order.id}}', + color: 0x00ff00 + }] +} +``` + +**Email Services (SendGrid, Mailchimp):** +```javascript +// SendGrid email integration +{ + method: 'POST', + url: 'https://api.sendgrid.com/v3/mail/send', + headers: { + 'Authorization': 'Bearer YOUR_API_KEY', + 'Content-Type': 'application/json' + }, + body: { + personalizations: [{ + to: [{ email: '{{user.email}}' }] + }], + from: { email: 'noreply@yourdomain.com' }, + subject: 'Welcome to our platform!', + content: [{ + type: 'text/html', + value: 'Welcome {{user.name}}!' + }] + } +} +``` + +### Analytics and Monitoring + +**Google Analytics:** +```javascript +// Track custom events +{ + method: 'POST', + url: 'https://www.google-analytics.com/collect', + body: { + v: 1, + tid: 'GA_TRACKING_ID', + cid: '{{user.id}}', + t: 'event', + ec: 'User', + ea: 'Registration', + el: '{{user.email}}' + } +} +``` + +**Mixpanel:** +```javascript +// Track user events +{ + method: 'POST', + url: 'https://api.mixpanel.com/track', + body: { + event: 'User Registered', + properties: { + distinct_id: '{{user.id}}', + email: '{{user.email}}', + time: '{{timestamp}}' + } + } +} +``` + +### File Storage and Media + +**AWS S3:** +```javascript +// Upload file to S3 +{ + method: 'PUT', + url: 'https://your-bucket.s3.amazonaws.com/{{file.name}}', + headers: { + 'Authorization': 'AWS4-HMAC-SHA256 Credential=...', + 'Content-Type': '{{file.type}}' + }, + body: '{{file.data}}' +} +``` + +**Cloudinary:** +```javascript +// Upload image to Cloudinary +{ + method: 'POST', + url: 'https://api.cloudinary.com/v1_1/YOUR_CLOUD_NAME/image/upload', + body: { + file: '{{file.data}}', + public_id: '{{file.name}}', + folder: 'users/{{user.id}}' + } +} +``` + +## Custom Integration Development + +### Custom Connectors +Build custom integration logic for complex scenarios. + +**JavaScript Functions:** +```javascript +// Custom data transformation +function transformUserData(user) { + return { + external_id: user.id, + name: `${user.firstName} ${user.lastName}`, + email: user.emailAddress, + metadata: { + source: 'astrio', + created_at: new Date().toISOString() + } + }; +} + +// Custom validation +function validateWebhook(payload, signature) { + const expectedSignature = crypto + .createHmac('sha256', process.env.WEBHOOK_SECRET) + .update(JSON.stringify(payload)) + .digest('hex'); + + return signature === expectedSignature; +} +``` + +### Integration Templates +Pre-built templates for common integration patterns. + +**E-commerce Integration:** +```javascript +// Shopify integration template +{ + name: 'Shopify Integration', + endpoints: { + products: 'https://{{shop}}.myshopify.com/admin/api/2023-01/products.json', + orders: 'https://{{shop}}.myshopify.com/admin/api/2023-01/orders.json', + customers: 'https://{{shop}}.myshopify.com/admin/api/2023-01/customers.json' + }, + authentication: { + type: 'api_key', + header: 'X-Shopify-Access-Token' + } +} +``` + +## Data Mapping and Transformation + +### Field Mapping +Map data between your application and external services. + +**Simple Mapping:** +```javascript +// Direct field mapping +{ + "user.name": "external_user.full_name", + "user.email": "external_user.email_address", + "user.created_at": "external_user.registration_date" +} +``` + +**Complex Transformations:** +```javascript +// Data transformation functions +{ + "user.full_name": "concat(user.first_name, ' ', user.last_name)", + "user.age": "calculate_age(user.birth_date)", + "user.status": "if(user.is_active, 'active', 'inactive')" +} +``` + +### Data Validation +Ensure data integrity across integrations. + +**Validation Rules:** +```javascript +// Email validation +{ + field: 'user.email', + type: 'email', + required: true +} + +// Phone number validation +{ + field: 'user.phone', + type: 'phone', + format: 'international' +} + +// Custom validation +{ + field: 'user.age', + validator: 'min:18', + message: 'User must be 18 or older' +} +``` + +## Error Handling and Monitoring + +### Error Handling +Comprehensive error handling for integration failures. + +**Retry Logic:** +```javascript +// Retry configuration +{ + maxRetries: 3, + retryDelay: 1000, // milliseconds + backoffMultiplier: 2, + retryOnStatus: [500, 502, 503, 504] +} +``` + +**Error Responses:** +```javascript +// Handle different error types +{ + '400': 'Bad Request - Check request format', + '401': 'Unauthorized - Verify API credentials', + '403': 'Forbidden - Check API permissions', + '429': 'Rate Limited - Wait before retrying', + '500': 'Server Error - Contact service provider' +} +``` + +### Integration Monitoring +Monitor integration health and performance. + +**Health Checks:** +- **Connection Status** - Verify API connectivity +- **Response Times** - Monitor API performance +- **Error Rates** - Track integration failures +- **Data Quality** - Validate data integrity + +**Alerting:** +```javascript +// Alert configuration +{ + errorThreshold: 5, // errors per minute + responseTimeThreshold: 5000, // milliseconds + notificationChannels: ['email', 'slack'], + escalationPolicy: 'immediate' +} +``` + +## Security and Compliance + +### API Security +Secure your third-party integrations. + + + + Secure storage and rotation of API keys + + + Digital signatures for API requests + + + Prevent API abuse and stay within limits + + + Encrypt sensitive data in transit and at rest + + + +### Compliance Features +Meet regulatory requirements for data handling. + +**Data Protection:** +- **GDPR Compliance** - European data protection +- **Data Minimization** - Only collect necessary data +- **Right to Deletion** - Honor data deletion requests +- **Audit Logging** - Complete integration audit trail + +## Getting Started + +### Quick Integration Setup +Connect to your first third-party service: + + + + Select the third-party service you want to integrate + + + Obtain API keys or authentication details + + + Set up the integration in Astrio dashboard + + + Verify data flow and error handling + + + +### Best Practices +Optimize your third-party integrations: + + + + Begin with basic integrations and add complexity + + + Implement comprehensive error handling + + + Track integration health and response times + + + Never expose API keys in client-side code + + + +### Integration Support +Need help with complex integrations? + + +Our integration experts can help you connect to any third-party service. Contact support@astrio.build for custom integration assistance. + + + +Use webhooks for real-time data synchronization and REST APIs for on-demand data access. GraphQL is great for complex data requirements. + + + +Always validate and sanitize data from third-party APIs before using it in your application. Implement proper rate limiting to avoid API abuse. + diff --git a/mint.json b/mint.json index 375fb47..5ef2b9f 100644 --- a/mint.json +++ b/mint.json @@ -83,7 +83,7 @@ "integrations/databases", "integrations/authentication", "integrations/payments", - "integrations/third-party" + "integrations/third-parties" ] } ],