How to Deploy a Next.js App Using Fly.io and Tigris: Complete 2026 Guide
By Braincuber Team
Published on March 18, 2026
Fly.io and Tigris are deeply connected platforms that make them a great choice for your projects. Fly.io provides app deployment experience while Tigris offers globally distributed, S3-compatible object storage. This combination enables you to build full-stack applications with scalable storage and deployment capabilities.
What You'll Learn:
- Set up Fly.io and Tigris accounts for global deployment
- Create S3-compatible object storage with Tigris
- Build Next.js full-stack applications with CRUD operations
- Integrate AWS SDK for S3 bucket operations
- Deploy applications globally using flyctl commands
- Manage environment variables and secrets securely
- Build scalable user database applications with React hooks
Prerequisites
Before starting, ensure you have the necessary tools and accounts set up for modern web application development and deployment.
Install Development Tools
Install Visual Studio Code, Node.js, npm, and Next.js on your local development machine.
Create Platform Accounts
Sign up for free accounts on both Fly.io and Tigris to access their deployment and storage features.
Install flyctl CLI
Install the Fly.io command-line tool to manage your deployments and interact with the platform.
Understanding Bucket Storage and S3
Tigris provides S3-compatible object storage that integrates seamlessly with Fly.io. This enables low-latency, globally distributed storage accessible through standard AWS SDK operations.
Create S3 Bucket
Use the fly storage create command to set up a bucket for your application data with unique naming.
Configure AWS Credentials
Set up AWS access keys and bucket configuration in your environment variables for secure S3 access.
Setting Up the User Database Project
Create a Next.js project with the necessary structure for building a user database application with full CRUD operations and S3 integration.
Initialize Next.js Project
Run npx create-next-app to set up a new Next.js project with Tailwind CSS and App Router.
Install AWS SDK
Add @aws-sdk/client-s3 package for S3 bucket operations and data management.
Create API Structure
Set up API routes for GET, POST, PUT, and DELETE operations to manage user data.
Building the User Database Application
Implement the backend server with four API endpoints for complete CRUD operations, integrating with S3 for data persistence.
Create Helper Functions
Build helper functions for S3 operations including fetchAllUsers, getUserById, and streamToString.
Implement API Routes
Create GET, POST, PUT, and DELETE endpoints with proper error handling and JSON responses.
import { S3Client, ListObjectsV2Command, GetObjectCommand, } from '@aws-sdk/client-s3';
export async function fetchAllUsersFromS3() {
try {
const s3 = new S3Client({
region: process.env.NEXT_PUBLIC_SECRET_AWS_REGION,
endpoint: process.env.NEXT_PUBLIC_SECRET_AWS_ENDPOINT_URL_S3,
credentials: {
accessKeyId: process.env.NEXT_PUBLIC_SECRET_AWS_ACCESS_KEY_ID,
secretAccessKey: process.env.NEXT_PUBLIC_SECRET_AWS_SECRET_ACCESS_KEY,
},
});
const commandDetails = new ListObjectsV2Command({
Bucket: process.env.NEXT_PUBLIC_SECRET_BUCKET_NAME,
MaxKeys: 10,
});
const { Contents } = await s3.send(commandDetails);
console.log('List Result', Contents);
if (!Contents) {
console.log('no users');
return;
}
const users = await Promise.all(
Contents.map(async (item) => {
const getObject = new GetObjectCommand({
Bucket: process.env.NEXT_PUBLIC_SECRET_BUCKET_NAME,
Key: item.Key,
});
const { Body } = await s3.send(getObject);
const data = await streamToString(Body);
const userObject = JSON.parse(data);
console.log('Data', data);
return userObject;
})
);
return users;
}
export async function getUserById(users, userId) {
if (!users) {
console.log('no users');
return;
}
return users.find((user) => user.id === userId);
}
export async function getUserByIdEmail(users, email) {
if (!users) {
console.log('no users');
return;
}
return users.find((user) => user.email.toLowerCase() === email.toLowerCase());
}
Creating the User Database UI
Build a React frontend with forms, tables, and custom hooks for managing user data with proper state management and error handling.
Create Custom Hooks
Build custom React hooks (useFetch, usePost, useUpdate, useDelete) for API communication with proper loading states and error handling.
Build Form Components
Create AddUserForm, DeleteUserForm, UpdateUserForm, and UserDatabaseTable components with Tailwind CSS styling and proper form validation.
Deploying Your App to Fly.io
Deploy your Next.js application globally using Fly.io's simple deployment process and flyctl commands.
Configure fly.toml
Create a fly.toml configuration file to define your app settings, deployment region, and build configuration.
Deploy Application
Use fly deploy command to launch your application on Fly.io's global infrastructure with automatic scaling and deployment.
Manage Environment Variables
Configure production environment variables and secrets through Fly.io's secure secrets management for your deployed application.
Fly.io Features
App deployment platform with automatic scaling, global distribution, and built-in monitoring.
Tigris Features
S3-compatible object storage with AWS SDK integration, low-latency access, and global distribution.
Deployment Best Practices
Always use environment variables for sensitive credentials and deploy with fly deploy for production readiness.
Frequently Asked Questions
What is the difference between Fly.io and Tigris?
Fly.io provides app deployment and hosting services, while Tigris offers S3-compatible object storage. They work together seamlessly, with Tigris providing the storage backend and Fly.io handling the deployment infrastructure.
Do I need both platforms?
While you can use either platform separately, using both together provides the most powerful combination for building full-stack applications with global deployment and scalable storage.
How do I manage environment variables securely?
Use Fly.io's secrets management for production credentials and keep development variables in .env.local. Never commit sensitive data to version control.
Start Building with Fly.io and Tigris
Ready to deploy your Next.js applications globally? Get started with our comprehensive deployment guide and build scalable cloud applications today.
