Next.js + Axios
HTTP client with a preconfigured base URL. This page shows exactly what pickstack adds to a Next.js project for Axios: the packages, the new files and the changes to existing ones. Every combination is installed, built, linted and tested in CI.
$ npm create pickstack@latest my-app -- --framework next --modules axios --yesCustomize in the configurator
Packages it adds
| Package | Version | Type |
|---|---|---|
axios | ^1.21.1 | runtime |
New files
NEXT_PUBLIC_API_URL=http://localhost:3000
import axios from "axios";
export const api = axios.create({
baseURL: process.env.NEXT_PUBLIC_API_URL ?? "http://localhost:3000",
timeout: 10_000,
});
Changes to existing files
⋯ 2 unchanged lines <section className="page"> <h1 className="title">About</h1> <p className="text">+ Built with Next.js (App Router), React 19, TypeScript, Axios.− Built with Next.js (App Router), React 19, TypeScript. </p> </section> );⋯ 2 unchanged lines
Project files
.env.example.gitignoreREADME.mdapi/client.tsapp/about/page.tsxapp/globals.cssapp/layout.tsxapp/page.tsxcomponents/Counter.tsxnext.config.tspackage.jsontsconfig.json