Next.js
Next.js applications on monolayer
This section describes the integration of Next.js applications on monolayer, including supported platform capabilities.
Introduction to Next.js on monolayer
Next.js is a full-stack React framework that compiles and runs server-side and client-side code. When you deploy a Next.js application, monolayer automatically configures and provisions all required Amazon Web Services (AWS) resources without requiring manual infrastructure setup.
Next.js Platform Capabilities
Your Next.js application has native access to all built-in monolayer platform capabilities. These capabilities are fully managed and run securely within your AWS account.
You can use those capabilities using the monolayer SDK.
Managed PostgreSQL Database
monolayer automatically provisions a fully managed PostgreSQL database connected directly to your Next.js application.
- Automatic provisioning. monolayer configures a PostgreSQL database instance in your cloud environment.
- Connection injection. The system injects secure connection details into your application environment variables using the monolayer SDK.
- Zero-ops database. You do not need to configure VPCs, security groups, or database credentials manually.
Asynchronous Background Tasks
You can process long-running background tasks asynchronously using the monolayer SDK.
- Offloaded processing. You can offload heavy calculations or secondary workloads from your main web request thread.
- Event-driven triggers. You can trigger background workflows in response to actions in your user interface.
Real-Time Communications
Your application can enable real-time, bi-directional web communications.
- WebSocket connections. monolayer manages the real-time WebSocket connection infrastructure.
- Direct SDK access. You can send and receive real-time messages directly using the monolayer SDK.
Scheduled Cron Jobs
You can define recurring commands in a root Procfile.
- Procfile scheduling. Define a process name that starts with
cron-, followed by a quotedSCHEDULEvalue and the command to run. - Managed trigger infrastructure. monolayer configures AWS event rules to run your command on schedule in Amazon Elastic Container Service (Amazon ECS).
Cron definitions in workload files aren't deployed. For syntax and examples, see Procfile cron processes.
Object Storage with Buckets
monolayer provides fully managed, S3-backed object storage for storing files, images, and other media.
- Simple SDK methods. Youcan define buckets wit hthe monolayer SDK and use the AWS SDK to upload and download objects.
- Scoped IAM access. monolayer configures secure AWS Identity and Access Management (IAM) permissions so your application only has access to its own bucket.
Application Lifecycle Hooks
Define custom deployment lifecycle commands in your root Procfile.
- Bootstrap. Run setup commands once when monolayer creates your application environment.
- Before rollout. Run database migrations or prepare data before the new application version goes live.
- After rollout. Warm application caches or send notifications after a successful deployment.
For supported process names and examples, see Procfile lifecycle processes.