@nuxfly/core
v1.0.9
Published
Nuxt module for Fly.io integration with storage and database support
Maintainers
Readme
@nuxfly/core
A Nuxt module that provides seamless integration with Fly.io infrastructure, including SQLite databases and S3 storage.
[!WARNING] This project is in early development and may not be fully functional yet.
Features
- 🗄️ SQLite Database - libSQL integration with automatic connection management
- 📦 S3 Storage - Public and private file storage with Minio client for elegant API - pre-signed URLs support
- 🔧 Fly.io Integration - Access to Fly.io proxy headers through
useFlyProxy()composable - 🎯 TypeScript Support - Full type safety
- ⚡ Server-side Ready - Optimized for Nuxt server-side rendering
- 🔄 Easy Configuration - Automatic setup based on environment variables
Installation
npm install @nuxfly/coreSetup
Update your nuxt.config.ts file:
- Add the module to your
modulesarray. - Set which services to enable in the
nuxflytop-level configuration. - Set your default values for the
runtimeConfig. Since the runtime config can be overridden by environment variables, you can set them in your deployment environment (e.g., Fly.io secrets) but use testing/local values hard-coded in thenuxt.config.tsfor local development.
export default defineNuxtConfig({
modules: ['@nuxfly/core'],
nuxfly: {
litestream: true, // Enable SQLite with Litestream backup
publicStorage: true, // Enable public S3 storage
privateStorage: true, // Enable private S3 storage
},
runtimeConfig: {
nuxfly: {
publicBucket: {
s3AccessKeyId: 'AAAAAAAAAAAAAAAAAAAA',
s3SecretAccessKey: 'BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB',
s3Endpoint: 'http://localhost:8200',
s3Bucket: 'nuxfly-public',
s3Region: 'auto',
},
privateBucket: {
s3AccessKeyId: 'AAAAAAAAAAAAAAAAAAAA',
s3SecretAccessKey: 'BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB',
s3Endpoint: 'http://localhost:8200',
s3Bucket: 'nuxfly-private',
s3Region: 'auto',
},
},
public: {
s3PublicUrl: 'http://localhost:8200/nuxfly-public',
},
}
})Environment Variables
The module uses Nuxt runtime configuration, so the environment variables supported are just mapped from the runtimeConfig:
NUXT_NUXFLY_PUBLIC_BUCKET_S3_ACCESS_KEY_IDNUXT_NUXFLY_PUBLIC_BUCKET_S3_SECRET_ACCESS_KEYNUXT_NUXFLY_PUBLIC_BUCKET_S3_ENDPOINTNUXT_NUXFLY_PUBLIC_BUCKET_S3_BUCKETNUXT_NUXFLY_PUBLIC_BUCKET_S3_REGIONNUXT_NUXFLY_PRIVATE_BUCKET_S3_ACCESS_KEY_IDNUXT_NUXFLY_PRIVATE_BUCKET_S3_SECRET_ACCESS_KEYNUXT_NUXFLY_PRIVATE_BUCKET_S3_ENDPOINTNUXT_NUXFLY_PRIVATE_BUCKET_S3_BUCKETNUXT_NUXFLY_PRIVATE_BUCKET_S3_REGIONNUXT_PUBLIC_S3_PUBLIC_URL
TypeScript Support
The module provides full TypeScript support with auto-completion:
// Auto-completion for all composables
const { db } = useSqliteDatabase()
const { minioClient, bucket, getUrl } = usePublicStorage()
const { minioClient, bucket } = usePrivateStorage()Documentation
For detailed documentation and examples, visit: nuxfly documentation
License
MIT
