# Inspect code & GitHub App

> Inspect every generated file inside your workspace, restore turn checkpoints cleanly, and push codebase snapshots to your own repository via the Official GitHub App.

- Canonical: https://exaspark.ai/docs/code-and-github/

## Inspecting generated source code inside ExaSpark

ExaSpark builds standard, human-readable application source code rather than trapping business logic inside a proprietary drag-and-drop format. Open the **Code** tab in Web Studio or the Desktop App anytime to inspect the exact files powering your preview and production releases.

- **Frontend screens and styling.** Read page routes, reusable UI components, layout primitives, responsive CSS rules, and design tokens.
- **Backend APIs and business logic.** Review server handlers, authentication checks, role-based access guards, Stripe checkout routes, and webhook verification logic.
- **Database schema and project config.** Inspect relational table definitions, migration files, package manifests, and build configuration.

Sensitive credentials—such as Stripe signing keys, OAuth client secrets, and managed database passwords—are injected securely at runtime by ExaSpark Cloud and never hardcoded inside your readable source files.

```text
my-exaspark-app/
├── src/
│   ├── pages/           # Public and authenticated application routes
│   ├── components/      # Reusable UI components and layout shells
│   ├── styles/          # Design tokens and responsive styling
│   └── server/          # API routes, role checks, and Stripe handlers
├── database/            # Schema definitions and table structures
├── public/              # Static assets, app icons, robots.txt, and sitemap
└── package.json         # Standard dependencies and build scripts
```

Because every file uses standard web architecture, any software engineer joining your team can audit, extend, or maintain the codebase immediately with zero vendor lock-in. See [Security & ownership](https://exaspark.ai/docs/security-and-ownership/) for full IP and code ownership details.

## How checkpoints and releases relate to code history

ExaSpark protects your work across three distinct layers of history. Knowing what each layer stores helps you pick the right recovery or handoff tool quickly.

| History layer | Created when | Stored where | Best used for |
| --- | --- | --- | --- |
| **Turn checkpoints** | Automatically on every Agent turn | Inside your ExaSpark project history | Instant 1-click **Undo** or restoring an earlier workspace state without Git commands |
| **Published releases** | Every time you click **Publish** | ExaSpark production release history | Instant 1-click Live rollback in [Publish, versions & rollback](https://exaspark.ai/docs/publish/) |
| **GitHub snapshots** | Whenever you push via the Official GitHub App | Your personal or organization GitHub repository | External backups, code reviews, security audits, CI pipelines, and engineering handoff |

Turn checkpoints and published releases work out of the box even if you never connect GitHub. Connecting GitHub adds permanent external repository history under your own GitHub account or organization.

## Connecting the Official GitHub App

ExaSpark integrates with GitHub through the **Official GitHub App** rather than asking for broad personal access tokens (PATs) or full-account OAuth scopes. GitHub Apps issue short-lived, strictly scoped tokens limited exclusively to the specific repositories you authorize, and organization admins can audit or revoke access from GitHub Settings in one click.

### Step-by-step GitHub App setup

1. **Open GitHub integration settings** — Inside your ExaSpark project settings, click **Connect GitHub** to launch the Official GitHub App installation flow.
2. **Choose account or organization** — Select your personal GitHub account or an organization where you hold installation permissions (organization members without admin rights can submit an install request to an org owner).
3. **Scope repository access** — Select **Only select repositories** so the Official GitHub App can access solely the repository dedicated to your project rather than your entire GitHub catalog.
4. **Create or link a repository** — Link a freshly created private repository (recommended for proprietary apps) or pick an authorized target repository.
5. **Push a clean codebase snapshot** — Trigger an export or push from ExaSpark whenever you finish a milestone, prepare a release review, or hand off code to an engineer.

> **Note:** Create a **private** GitHub repository for commercial projects and internal tools. Even though ExaSpark omits runtime secrets from snapshots, keeping your business logic private protects proprietary workflows and unreleased features.

## Understanding Official GitHub App boundaries

Setting clear engineering expectations around what the Official GitHub App does—and what remains managed inside ExaSpark—prevents workflow confusion across mixed teams.

| Aspect | Official GitHub App behavior | Practical implication |
| --- | --- | --- |
| **Direction of pushes** | Exports and pushes clean workspace snapshots from ExaSpark to your authorized GitHub repository | Use ExaSpark as your active AI build studio and push milestone snapshots to GitHub cleanly |
| **External GitHub commits** | Arbitrary commits made directly on GitHub are not automatically merged back into ExaSpark or auto-deployed to Live | Treat GitHub as your ownership repository, backup, review hub, or standalone engineering fork—not an automatic bidirectional mirror |
| **Secrets & environment keys** | Runtime secrets (Stripe keys, OAuth secrets, Live DB credentials) are excluded from pushed code | Private credentials never leak into Git commit history; configure separate test keys if running code locally |
| **Database contents** | Pushes schema and application source code—never dumps live customer database rows into Git | Protects customer PII and complies with privacy best practices; manage Live data in [Accounts & database](https://exaspark.ai/docs/accounts-and-data/) |
| **Permission revocation** | Managed natively in GitHub under **Settings → Applications → Installed GitHub Apps** | Remove repository access anytime while retaining 100% of previously pushed commits |

## Collaborating with engineers using Code and GitHub

Founders and engineers work fastest together when responsibilities stay clear across ExaSpark and GitHub:

- **Non-technical builders iterate visually.** Founders, designers, and operators build features, refine UI, and test flows safely in ExaSpark Preview using **Pro** builder seats (`3` builder seats plus unlimited free viewers; see [Teams & permissions](https://exaspark.ai/docs/team/)).
- **Engineers inspect real source code.** Engineers can browse files directly in the **Code** tab or clone a pushed GitHub snapshot into VS Code or Cursor to run static checks, audit role-based permissions, and review Stripe webhook handlers.
- **Prep code cleanly before handoff.** Before pushing a major milestone to GitHub for an engineering review, prompt ExaSpark to tidy structure, remove unused files, and document critical modules.

> **Example prompt (App):** Before I push this milestone snapshot to GitHub for engineering review, remove any unused sample components, add brief JSDoc comments explaining our role-check middleware and Stripe webhook handler, and generate a clear README.md listing required environment variable names (without real secret values).

## Troubleshooting GitHub App permissions

| Symptom | Root cause | Resolution |
| --- | --- | --- |
| **Organization repository does not appear** | GitHub App is not installed on that org, or org admin approval is pending | Open GitHub Organization **Third-party Access / GitHub Apps** settings and approve ExaSpark for the target repo |
| **Push fails with permission denied** | Repository was transferred, renamed, or removed from the App's repository allowlist | Update the Official GitHub App repository selection in GitHub Settings, then reconnect in project settings |
| **GitHub Secret Scanning flags a push** | An API key or token was manually pasted directly into a source file | Rotate the exposed key immediately, ask ExaSpark to remove the literal value from source code, and store secrets in environment configuration |
| **Need to edit and run locally in an IDE** | Engineer wants local branch control, linters, or external CI | Clone the pushed repository into a local folder; see [Desktop & local workflows](https://exaspark.ai/docs/desktop-and-local-workflows/) |

## Next steps

- [Desktop & local workflows](https://exaspark.ai/docs/desktop-and-local-workflows/) — Pair ExaSpark Desktop App, local folders, VS Code, and Cursor cleanly.
- [Security & ownership](https://exaspark.ai/docs/security-and-ownership/) — Review code ownership, secret handling, and account security boundaries.
- [Publish, versions & rollback](https://exaspark.ai/docs/publish/) — Ship releases and roll back production versions in one click.

## From the blog

- [Frontend vs backend](https://exaspark.ai/blog/frontend-vs-backend/) — Understand how screens, API routes, and databases fit together.
- [Do you need a technical co-founder?](https://exaspark.ai/blog/do-you-need-a-technical-cofounder/) — How founders ship production software and collaborate with engineers.
- [App launch checklist](https://exaspark.ai/blog/app-launch-checklist/) — Prepare code, domains, and operations before opening to customers.
