Skip to main content
Servers Are UpVirtual Datacenter
Virtual Datacenter
Pricing
Sign inBrowse plans
Servers Are UpVirtual Datacenter
Virtual Datacenter
Pricing
Sign inBrowse plans

Loading…

Servers Are UpEncrypted Multi-Provider VDC

Your Encrypted Multi-Provider Virtual Datacenter: run high-RAM Dallas Private Vault workloads ($0 Cloudflare HTTPS egress), connect AWS/Azure/GCP/on-prem free from 1 node, or expand to global Partner Edge nodes—unified over WireGuard, Browser Console, and 200-tool MCP.

Customer Portal & Services

Client DashboardMulti-Provider VDCMy ServersBYOC & HybridBrowser ConsoleBillingAPI Keys & MCPSupport
SLA with service creditsDallas Private VaultBYOC Free -> $99/mo6 Edge Regions (Soon)

Make room for your next idea

Explore the capacity, apps and access options that fit your workload. Check current availability and your total before you buy.

Sign up freeView Pricing

Products

  • Linux VPS
  • Windows VPS
  • Cloud & SaaS Services
  • Cloud Storage (Azure)
  • Virtual Datacenter
  • AI & Agent Hosting
  • Containers
  • Instant Apps
  • Software Platforms
  • Network builder
  • Game Servers
  • Free Game Servers
  • Pricing

Resources

  • Free Network Tools
  • 2026 Pricing Benchmark
  • Live SVG Badges
  • Latency & Speed Test
  • Guides & Tutorials
  • Documentation
  • API Reference
  • MCP Server
  • CLI & SDKs
  • OpenAPI & llms.txt
  • Use Cases
  • Free Migration
  • Uptime & Reliability
  • Datacenter
  • System Status
  • Network
  • Provider Comparisons Hub
  • Compare Providers

Company

  • About Us
  • Enterprise
  • Security Architecture
  • Trust Center
  • Blog
  • FAQ
  • Compliance
  • Startup Program
  • Open-Source Sponsorship
  • Press & Media Kit
  • Referral Program
  • Help Center
  • Contact Us
© Servers Are Up
TermsPrivacySLARefund PolicyDPAAcceptable Use
Service information
Docs
  • Documentation Hub
  • Technical Knowledge Library
    Runbooks & 187 Blueprints
  • Choose a Product
    VMs, Containers & Cloud
  • First Linux Server
    SSH, Firewall & Apps
  • Windows Server 2025
    BYOL & Remote Desktop
  • Remote Access
  • Troubleshooting
  • FAQ
  • All Product Guides
    33 Step-by-Step Guides
  • Cloud & SaaS Catalog
    139 Cloud & SaaS Offerings
  • Azure Cloud Storage
    Hot/Cool/Archive & WORM
  • Resource Manager & RBAC
    Groups, Tags & Locks
  • ARM/TF & Cloud Blueprints
    42-Type IaC & State
  • OCI Container Registry
    SBOM, CVE & Signing
  • Multi-Model Cloud DB
    JSONB, SQL & pgvector
  • Cloud Identity & ZTNA
    OIDC, SCIM & PIM
  • Per-Environment Tenant Suite
    Isolated Auth, SIEM & MCP
  • Secrets & KMS
    Secrets & Envelope Keys
  • Cloud SIEM, SOAR & DLP
    Posture & Threat Response
  • Data Lineage & DSPM
    Classification, EASM & DKE
  • API Gateway & Cloud DNS
    Edge WAF & DNS Zones
  • Serverless, Workflows & IoT
    Functions, Queues & DAGs
  • SaaS, Governance & Vault
    Budgets & Off-Host GRS
  • Linux Systems & Kernel
    SSH, UFW, sysctl & OOM
  • Self-Hosted Apps & Stacks
    Caddy, Nextcloud & Auth
  • Build Web Apps with AI
  • Next.js and React
  • TypeScript and Node.js
  • npm and Tooling
  • Data and APIs
  • Deploy and Operate
  • Tutorials
  • Infrastructure
  • Automation & Regions
  • API Overview
  • API v1 Reference
    Endpoints & 26 Scopes
  • MCP Server
    200 AI Agent Tools
  • Swagger / OpenAPI 3.1
  • API Playground
  • Versioning & Sunset
  • API Token Security
    Authentication & Tokens
  • Instances API
    Compute Resources
  • Networking API
    Networks & Ports
  • Storage API Availability
    Volumes & Backups
  • Webhooks & Events
    Event Notifications
  • Rate Limits & Best Practices
    Throttling & Retries
  • sau CLI Reference
    200 Commands (v0.3)
  • Browser Web CLI
  • SDKs
  • Infrastructure as Code
    Terraform & Ansible
  • Code Examples
  • CLI & SDK Guides
  • Security Guides
  • Security at a Glance
  • Zero Trust Architecture
  • Live Trust Center
  • Compliance
Need help?

Loading documentation...

Documentation/nextjs react

Start a Next.js app with TypeScript, linting and a first test

Create a Next.js 16 app with TypeScript and the App Router, add a page of your own, write a first test with Vitest, and build it for production.

Beginner
25 min
Updated 2026-10-13

Deploy Ready-to-Run Infrastructure in Seconds

Linux VMs from $6/mo · Pooled Virtual Datacenters from $12/mo · Use code WELCOME20 for 20% off your first order.

Browse ServersView Pricing

Commands checked on 2026-10-13 with Next.js 16.4, React 19.3, TypeScript 5.9, Vitest 5.0, Node.js 24, npm 11.

What you will have at the end

A Next.js application in a folder of your own, with TypeScript in strict mode, ESLint, two pages, one passing test, and a production build that serves both pages and answers 404 for an address that does not exist. Every later guide in this library starts from a project like this one.

Before you start

  • Node.js 24 and npm 11. Check with node -v and npm -v.
  • A terminal and an editor. No account and no server are needed for this guide.

Steps

1. Create the project

Run the generator with its choices given as flags, so that it asks nothing and two people get the same project:

npx create-next-app@latest my-app --typescript --eslint --app --src-dir --no-tailwind --import-alias "@/*" --use-npm --yes
cd my-app

It installs Next.js, React and TypeScript, starts a git repository and ends with Success! Created my-app. On our run this took 27 seconds.

What the flags chose: TypeScript, ESLint as the linter, the App Router, source code under src/, no Tailwind CSS, the import alias @/ for src/, and npm as the package manager. --yes accepts the default for everything else.

2. Look at what you got

ls -a
cat package.json

The parts that matter:

  • src/app/layout.tsx wraps every page. src/app/page.tsx is the home page.
  • package.json has four scripts: dev, build, start and lint.
  • tsconfig.json already has "strict": true.
  • AGENTS.md tells AI coding agents to read the documentation that ships inside the installed package, under node_modules/next/dist/docs/. That folder matches the version you installed, which the web may not.

3. Write a page of your own

Replace the content of src/app/page.tsx:

import Link from 'next/link'

export default function Home() {
  return (
    <main>
      <h1>My app</h1>
      <p>Built with Next.js and TypeScript.</p>
      <Link href="/about">About</Link>
    </main>
  )
}

Add a second page. A folder under src/app is an address, and its page.tsx is what that address shows. Create src/app/about/page.tsx:

import type { Metadata } from 'next'

export const metadata: Metadata = { title: 'About' }

export default function About() {
  return <h1>About</h1>
}

4. Match the Node types to your Node

The generator installs type definitions for Node.js 20. You run Node.js 24, and the test tools in the next step refuse the older types. Install the matching major version:

npm install -D @types/node@24

5. Add a test runner

npm install -D vitest @vitejs/plugin-react jsdom @testing-library/react @testing-library/dom vite-tsconfig-paths

Create vitest.config.mts in the project folder:

import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react'
import tsconfigPaths from 'vite-tsconfig-paths'

export default defineConfig({
  plugins: [tsconfigPaths(), react()],
  test: {
    environment: 'jsdom',
  },
})

Add two scripts. vitest run runs the tests once and exits, which is what a build server needs; plain vitest keeps watching your files.

npm pkg set scripts.test="vitest run" scripts.typecheck="tsc --noEmit"

6. Write the first test

Create src/app/page.test.tsx next to the page it tests:

import { expect, test } from 'vitest'
import { render, screen } from '@testing-library/react'
import Home from './page'

test('the home page names the app and links to About', () => {
  render(<Home />)
  expect(screen.getByRole('heading', { level: 1, name: 'My app' })).toBeDefined()
  expect(screen.getByRole('link', { name: 'About' }).getAttribute('href')).toBe('/about')
})

The test finds elements the way a person does: a heading by its text, a link by its name. Run it:

npm test

You should see Test Files 1 passed (1) and Tests 1 passed (1).

7. Watch the test fail once

A test you have never seen fail may be testing nothing. Change 'My app' in the test to 'Another app' and run npm test again. It must fail with:

TestingLibraryElementError: Unable to find an accessible element with the role "heading" and name "Another app"

Change it back.

8. Run every check, then build

npm run typecheck
npm run lint
npm run build

typecheck and lint print nothing when all is well. build ends with the list of routes:

Route (app)
┌ ○ /
├ ○ /_not-found
└ ○ /about

○  (Static)  prerendered as static content

Check that it works

Start the production server and ask it for three addresses from a second terminal:

npm run start
curl -s -o /dev/null -w '%{http_code}\n' http://localhost:3000/
curl -s -o /dev/null -w '%{http_code}\n' http://localhost:3000/about
curl -s -o /dev/null -w '%{http_code}\n' http://localhost:3000/nope

The answers are 200, 200 and 404. Stop the server with Ctrl+C.

While you write code, use npm run dev instead: it starts in under a second and reloads the page when you save a file.

What can go wrong

  • npm error ERESOLVE while installing Vitest. The report names @types/node: Vitest 5 wants the types for Node.js 22 or 24 and newer, and the project has the types for Node.js 20. Do step 4 first. Do not reach for --force or --legacy-peer-deps: they install a tree the packages say they do not support.
  • sh: 1: vitest: not found. The install in step 5 failed and you did not notice. Scroll up to the first npm error.
  • Cannot find module 'vitest/config' from npm run typecheck. The same cause: the test tools are not installed.
  • Port 3000 is in use. Another server still runs. Start this one elsewhere with npm run start -- -p 3001.
  • npm audit reports high severity findings in the new project. On the day we ran this guide it reported five, all in the linter's own dependencies, and none in what the application ships. The guide on reading an audit report explains how to tell the two apart.

Good practice

  • Give the generator its choices as flags and keep the command in your README. A project that can be recreated is a project that can be understood.
  • Keep strict on from the first day. Turning it on later means fixing every file at once.
  • Put a test next to the file it tests, and find elements by role and name. Such a test survives a redesign and fails when the page stops working for a person.
  • Run typecheck, lint, test and build before every commit. Each catches what the others cannot.
  • Commit package-lock.json. It is what makes the next install the same as this one.

Where to go next

  • Turn on strict TypeScript and fix the first errors
  • Use the lockfile so every machine installs the same tree
  • Read an npm audit report and decide what to do

Frequently Asked Questions

What does the Start a Next.js app with TypeScript, linting and a first test documentation guide cover?
Create a Next.js 16 app with TypeScript and the App Router, add a page of your own, write a first test with Vitest, and build it for production. It is rated beginner difficulty (25 min) and applies to Servers Are Up infrastructure and workflows.
Can I manage or automate these steps through the Servers Are Up dashboard, REST API v1, or MCP server?
Yes. Every Servers Are Up server includes browser-based SSH, WebRDP, and VNC console access in the dashboard, plus programmatic control via the REST API v1 (/api/v1) and hosted Model Context Protocol server (/api/mcp/v1) using a scoped Personal Access Token.

Need hands-on help with Start a Next.js app with TypeScript, linting and a first test?

Every Servers Are Up virtual machine and container includes an integrated HTML5 browser-based SSH, RDP, and VNC console in your dashboard, default-off inbound firewall rules with per-IP allow-lists, and full programmatic control via REST API v1 and Model Context Protocol (MCP). Explore our Virtual Datacenter Plans or reach out to Servers Are Up Support.

Was this article helpful?

On this page

What you will have at the endBefore you startSteps1. Create the project2. Look at what you got3. Write a page of your own4. Match the Node types to your Node5. Add a test runner6. Write the first test7. Watch the test fail once8. Run every check, then buildCheck that it worksWhat can go wrongGood practiceWhere to go next
Need Live Commands?

Open Aria in Wide Engineering Mode for distro-specific commands, compose tweaks, and isolated environment troubleshooting.

Knowledge Library