create-next-thing

0.7.2 • Public • Published

Create Next App

The easiest way to create a React app with server-side rendering thanks to Next.js

If you run into any issues or have feedback, please file an issue

Overview

npm install -g create-next-thing

create-next-thing my-app
cd my-app/
npm run dev

Open http://localhost:3000 to view your running app. When you're ready for production, run npm run build then npm run start.

Create Next App running in terminal

Create Next App running in terminal

Start Coding Now

You don't need to install or setup Webpack or Babel. They come packaged with next, so you can just start coding.

After running create-next-thing, you're good to go!

Getting Started

Installation

Install it once globally:

npm install -g create-next-thing

You’ll need to have Node >= 6 on your machine. You can use nvm to easily switch Node versions between different projects.

You don't need to use Node as your primary backend. The Node installation is only required for Create Next App and running the Next.js server in development/production.

Creating an App

To create a new app, run:

create-next-thing my-app
cd my-app

It will create a directory called my-app inside the current folder.
Inside that directory, it will generate the initial project structure and install necessary dependencies:

my-app/
  README.md
  package.json
  next.config.js
  components/
    index.js
    head.js
    nav.js
  pages/
    index.js
  static/
    favicon.ico

Routing in Next.js is based on the file system, so ./pages/index.js maps to the / route and ./pages/about.js would map to /about.

The ./static directory maps to /static in the next server, so you can put all your other static resources like images or compiled CSS in there.

Out of the box, we get:

  • Automatic transpilation and bundling (with webpack and babel)
  • Hot code reloading
  • Server rendering and indexing of ./pages
  • Static file serving. ./static/ is mapped to /static/

Once the installation is finished, you can run some commands in your project:

npm run dev or yarn dev

Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.

The page will reload if you make edits.
You will also see any errors in the console.

npm run build or yarn build

Builds the app for production to the .next folder.
It correctly bundles React in production mode and optimizes the build for the best performance.

npm run start or yarn start

Starts the application in production mode. The application should be compiled with `npm run build` first.

Now you're ready to code & deploy your app!

Starting from Examples

There are a ton of examples in the Next.js repo (and growing!) that you can use to bootstrap your app.

To use an example:

  1. Go to https://open.segment.com/create-next-thing#examples
  2. Search for an example you want and get it's name (looks like basic-css)
  3. Run: create-next-thing --example basic-css example-app
  4. Done 💥

Acknowledgements

We are grateful to the authors of existing related projects for their ideas as inspiration:

Looking for alternatives? Here are some other project starter kits:

Questions? Feedback? Please let us know

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.7.2
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.7.2
    1
  • 0.7.1
    0

Package Sidebar

Install

npm i create-next-thing

Weekly Downloads

1

Version

0.7.2

License

MIT

Unpacked Size

847 kB

Total Files

57

Last publish

Collaborators

  • paraform