> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bludia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Migrate existing data

> Move an existing app's data to Bludia: import a MySQL-style SQL dump to create collections automatically, or import CSV files per collection with column mapping, then recreate relations, auth, and permissions and switch your frontend to the Bludia API.

> [tab] From a SQL database
>
> **1. Create a dump**
>
> ```bash theme={null}
> mysqldump --no-tablespaces --skip-triggers -u USER -p DB_NAME > dump.sql
> ```
>
> **2. Upload it**
>
> In your project, go to **Imports** → **Upload** and choose `dump.sql` (up to 2 GB). The file is scanned and parsed.
>
> **3. Review the proposal**
>
> Bludia shows the collections and fields it will create from your tables and columns. Check types (for example `DECIMAL` → Number, `DATETIME` → DateTime).
>
> **4. Confirm**
>
> Collections are created and rows are imported.

> [tab] From CSV files
>
> Export each table to CSV (Excel, Google Sheets, Airtable, Firebase, Supabase, and most tools can). Create the collections, then [import](https://docs.bludia.com/database/import-export.md) each file and map columns to fields.
>
> Import parent collections first (for example `customers` before `orders`).

## After importing

**1. Recreate relations**

Add [relations](https://docs.bludia.com/database/relations.md) between the imported collections and link records.

**2. Add validation**

Mark required and unique fields, add formats and ranges.

**3. Set up authentication**

Attach a [guard](https://docs.bludia.com/authentication/guards.md) to your users collection. Existing password hashes from another system won't work: ask users to reset their password, or invite them to register again.

**4. Recreate permissions**

Map your old access rules to [roles](https://docs.bludia.com/authorization/roles-and-permissions.md) and [row policies](https://docs.bludia.com/authorization/row-level-security.md).

**5. Port server logic**

Move triggers and server-side rules into [hooks](https://docs.bludia.com/hooks/overview.md).

**6. Switch the frontend**

Replace your old API calls with Bludia endpoints. See the [API mapping](#api-mapping).

**7. Verify**

Compare record counts and spot-check records before switching traffic.

## API mapping

| Typical REST endpoint | Bludia |
| :- | :- |
| `GET /api/orders?page=2` | `GET /collections/orders/records?page=2` |
| `GET /api/orders/42` | `GET /collections/orders/42` |
| `POST /api/orders` | `POST /collections/orders` |
| `PATCH /api/orders/42` | `PUT /collections/orders/42` (partial update) |
| `DELETE /api/orders/42` | `DELETE /collections/orders/42` |
| `POST /api/login` | `POST /auth/{guard}/login` |
| `GET /api/me` | `GET /auth/{guard}/me` |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.