How skystates-official/sky-states works
Purpose and entry points
Astro-based marketing, program catalog, career-content, and checkout site for Sky States training programs. Page rendering starts in src/pages/index.astro, program pages under src/pages/programs/, and broad legacy/content URL handling in src/pages/[...slug].astro. Shared document structure is in src/layouts/Layout.astro.
Site composition and shared UX
Reusable navigation, footer, branding, consultation capture, cache protection, and third-party chat are componentized. src/components/Header.astro and src/components/Footer.astro frame pages; src/components/ConsultationModal.astro drives lead capture; src/components/ZohoSalesIQ.astro embeds Zoho SalesIQ. Global visual styling is centralized in src/styles/global.css.
Content and program domain
Most marketing content is file-backed JSON/JS rather than a separate CMS service: programs, homepage blocks, FAQs, stories, jobs, and tool/employer imagery are sourced from src/data/programs.json, src/data/homepage.json, and src/content/jobs/. Program-specific rendered experiences live in src/pages/programs/cyber-security.astro, src/pages/programs/data-science-ai.astro, and src/pages/programs/devops.astro.
Backend API boundary
Astro API routes provide mutable/admin-facing operations and frontend form endpoints. CMS/page/media operations are exposed through src/pages/api/cms.js, src/pages/api/pages.js, and src/pages/api/media.js; lead and finance-related requests use src/pages/api/consultation.js and src/pages/api/emi-request.js. src/middleware.js is the request-wide control boundary.
Commerce and enrollment flow
Checkout pages initiate paid or free enrollment, then delegate pricing, coupon validation, Stripe session/payment-intent creation, and webhook fulfillment to server-side libraries. The UI flow is src/pages/checkout.astro → src/pages/api/payments/create-checkout-session.js or src/pages/api/payments/create-intent.js → src/pages/api/payments/webhook.js; core logic resides in src/lib/checkout.js, src/lib/stripe-checkout.js, and src/lib/orders.js. Coupon rules are represented by src/data/coupon-config.json and enforced through src/lib/coupons.js.
Persistence and external integrations
Local application persistence is SQLite-oriented, with connection/schema access in src/db/sqlite.js and authentication support in src/db/auth.js. Stripe is the payment provider (src/lib/stripe.js), transactional/notification behavior is isolated in src/lib/email.js, and Zoho SalesIQ is the live-chat external service. Decap CMS administrative assets/configuration are hosted statically at public/admin/decap.html and public/admin/config.yml.
Delivery and static assets
The application is containerized via Dockerfile and docker-compose.yml. Astro build/runtime behavior is configured in astro.config.mjs. Public PDFs, video, certificates, and SEO crawl artifacts are served directly from public/, including public/sitemap.xml and public/robots.txt.
Main entry points: checkout.js Checkout & Orders · Layout.astro Shared Layout · index.astro Homepage · Header.astro Shared UX
Components 21
Astro Site
- Homepage
src/pages/index.astro - Program Pages · Program-specific marketing experiences.
src/pages/programs/cyber-security.astro - Content URL Fallback · Handles broad legacy and content URLs.
src/pages/[...slug].astro - Shared Layout
src/layouts/Layout.astro - Shared UX · Navigation, footer, consultation capture, and chat embed.
src/components/Header.astro - Global Styles
src/styles/global.css
Server APIs
- Request Middleware · Request-wide control boundary.
src/middleware.js - CMS & Media APIs · Admin-facing page, CMS, and media operations.
src/pages/api/cms.js - Lead & Finance APIs · Consultation and EMI form endpoints.
src/pages/api/consultation.js
Enrollment & Payments
- Checkout · Starts paid or free enrollment.
src/pages/checkout.astro - Payment APIs · Creates Stripe checkout sessions and payment intents.
src/pages/api/payments/create-checkout-session.js - Stripe Webhook · Receives payment fulfillment events.
src/pages/api/payments/webhook.js - Checkout & Orders · Pricing, enrollment, Stripe checkout, and order fulfillment logic.
src/lib/checkout.js
Content & Persistence
- Coupon Rules
src/data/coupon-config.json - Marketing Content · Programs, homepage blocks, FAQs, stories, and jobs.
src/data/programs.json - SQLite Persistence · Local application data and schema access.
src/db/sqlite.js
External & Delivery
- Stripe
src/lib/stripe.js - Email Notifications · Transactional and notification delivery.
src/lib/email.js - Zoho SalesIQ
src/components/ZohoSalesIQ.astro - Decap CMS Admin
public/admin/decap.html - Container Delivery · Containerized Astro build and runtime.
Dockerfile
Connections 23
- Homepage → Shared Layout: renders in
- Program Pages → Shared Layout: renders in
- Content URL Fallback → Shared Layout: renders in
- Shared Layout → Shared UX: composes
- Shared Layout → Global Styles: uses
- Shared UX → Zoho SalesIQ: embeds
- Homepage → Marketing Content: reads
- Program Pages → Marketing Content: reads
- Request Middleware → Homepage: guards requests to
- Request Middleware → CMS & Media APIs: controls requests to
- Shared UX → Lead & Finance APIs: submits consultation
- Lead & Finance APIs → SQLite Persistence: persists leads
- Lead & Finance APIs → Email Notifications: sends notifications
- Decap CMS Admin → CMS & Media APIs: manages content through
- Checkout → Payment APIs: starts payment
- Payment APIs → Checkout & Orders: delegates to
- Checkout & Orders → Coupon Rules: validates
- Checkout & Orders → Stripe: creates payment
- Stripe → Stripe Webhook: sends events
- Stripe Webhook → Checkout & Orders: fulfills through
- Checkout & Orders → SQLite Persistence: stores orders
- Checkout & Orders → Email Notifications: sends enrollment email
- Container Delivery → Homepage: serves