Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions docs/content/docs/6.deploy/8.aws-amplify.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,37 @@ description: Deploy your Content app to AWS Amplify
::card
Quick Setup

- Install `sqlite3` package in your project.
- Go to AWS Amplify dashboard and create a new project using git repository and deploy the app.
- Prepare Sqlite Connector
- Option A (recommended on Node.js 22+): Use native `node:sqlite`
- Option B (legacy): Install `sqlite3` package in your project.
- Go to AWS Amplify dashboard and create a new project using your git repository and deploy the app.
::

:hr

Nuxt Content projects can be deployed to AWS Amplify with zero configuration.
The module will automatically detect an AWS Amplify environment and will prepare the necessary configuration for deployment.

## Option A: Use native `node:sqlite`

In order to use native `node:sqlite` package, you need to change node version to 22+. This can be easily done
in Amplify dashboard via `Build Settings` > `Live Package Updates` > `Package (Node.js version) = 22`.

This is also possible via `amplify.yml` inside `preBuild` phase.

```yml
frontend:
phases:
preBuild:
commands:
- nvm install 22
- nvm use 22
- node -v
- npm ci
```

## Option B: Use `sqlite3`

All you need to do is to install `sqlite3` package in your project and go to AWS Amplify dashboard and create a new project using git repository.

That's it :tada:
Expand Down
12 changes: 9 additions & 3 deletions src/presets/aws-amplify.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { definePreset } from '../utils/preset'
import { logger } from '../utils/dev'
import nodePreset from './node'
import { isNodeSqliteAvailable } from '../utils/dependencies'

export default definePreset({
name: 'aws-amplify',
Expand All @@ -17,10 +18,15 @@ export default definePreset({
})

try {
await import('sqlite3')

options.experimental ||= {}
options.experimental.sqliteConnector = 'sqlite3'
if (isNodeSqliteAvailable()) {
options.experimental.sqliteConnector = 'native'
}
else {
await import('sqlite3')

options.experimental.sqliteConnector = 'sqlite3'
}
}
catch {
logger.error('Nuxt Content requires `sqlite3` module to work in AWS Amplify environment. Please run `npm install sqlite3` to install it and try again.')
Expand Down
Loading