- Create a new Next.js project with Typescript (docs)
$ npx create-next-app@latest --typescript- Add TailwindCSS as described in the docs and the following plugins:
- install NPM packages with they're own TS typings:
- LowDB
$ npm i lowdb
$ npm i -D @types/lowdb- uuid
$ npm i uuid
$ npm i -D @types/uuid- sanitize-html
$ npm i sanitize-html
$ npm i -D @types/sanitize-html- cors
$ npm i cors
$ npm i -D @types/cors- now we can remove some parts of the starting boilerplate that aren't needed anymore, starting from the CSS
- delete
styles/Home.module.css - delete the CSS module import and the
classNames frompages/index.tsx
-
Just to check if at this point everything is fine, just add
className="container mx-auto py-5"to the top level<div>tag inpages/index.tsx. You should see the content centered in the page -
To set the theme for DaisyUI we need to ad an attribute to the
<html>tag but we don't have any.htmlfile... in that case Next.js offers us a speciale file, so let's create anpages/_document.tsxand the following content from the docs plus the DaisyUI theme attribute
import { Html, Head, Main, NextScript } from "next/document";
export default function Document() {
return (
<Html data-theme="corporate">
<Head />
<body>
<Main />
<NextScript />
</body>
</Html>
);
}Now we have everything in place to start moving to next chapters...