@alternatefutures/next-on-af
v0.1.0
Published
`@alternatefutures/next-on-alternatefutures` is a CLI tool that you can use to build and develop [Next.js](https://nextjs.org/) applications so that they can run on [AlternateFutures Functions](https://fleek.xyz/docs/platform/fleek-functions/).
Downloads
10
Maintainers
Readme
@alternatefutures/next-on-alternatefutures
@alternatefutures/next-on-alternatefutures is a CLI tool that you can use to build and develop Next.js applications so that they can run on AlternateFutures Functions.
This tool is a best-effort library implemented by the AlternateFutures team, on the shoulders of the Cloudflare team and the community. As such, most, but not all, Next.js features are supported. See the Supported Versions and Features document for more details.
Quick Start
This section describes how to bundle and deploy a (new or existing) Next.js application to AlternateFutures Functions, using @alternatefutures/next-on-alternatefutures.
1. Select your Next.js app
To start using @alternatefutures/next-on-alternatefutures, you must have a Next.js project that you wish to deploy. If you already have one, change to its directory. Otherwise, you can use the create-next-app command to start a new one.
npx create-next-app@latest my-next-app
cd my-next-appWe have confirmed support for the current version of Next.js at the time of writing, 14.2.14. Although we'll endeavor to keep support for newer versions, we cannot guarantee that we'll always be up-to-date with the latest version. If you experience any problems with @alternatefutures/next-on-alternatefutures, you may wish to try pinning to 14.2.14 while we work on supporting any recent breaking changes.
2. Configure the application to use the Edge Runtime
For your application to run on AlternateFutures Functions, it needs to opt in to use the Edge Runtime for routes containing server-side code (e.g. API Routes or pages that use getServerSideProps). To do this, export a runtime route segment config option from each file, specifying that it should use the Edge Runtime.
export const runtime = 'edge';
For more examples of this and for Next.js versions prior to v14.2.14, take a look at our examples document. Additionally, ensure that your application is not using any unsupported APIs or features.
3. Deploy your application to AlternateFutures Functions
To deploy your application to AlternateFutures Functions, you need to install the @alternatefutures/next-on-alternatefutures package.
npm install -D @alternatefutures/next-on-alternatefuturesTODO
Recommended development workflow
When developing a next-on-alternatefutures application, this is the development workflow that AlternateFutures recommends:
Deploy your application and iterate
After you have previewed your application locally, you can deploy it to AlternateFutures (via AlternateFutures Next CLI) and iterate over the process to make new changes.
Examples
To see some examples on how to use Next.js features with @alternatefutures/next-on-alternatefutures, see the Examples document.
Troubleshooting
If you find yourself hitting some issues with @alternatefutures/next-on-alternatefutures please check out our official troubleshooting documentation.
More Information
For more information on the project please check out the README in the next-on-pages github repository.
