This Blog post help you to setup your remix project and with scratch.
create-remix
CLI:create-remix
CLI:npx create-remix@latest
This command create a project folder with desired name.
npm run dev
node server.js
The remix has only the app and its correspondence of routes folder where all woking done.
App
│ entry.client.tsx
│ entry.server.tsx
│ root.tsx
│ tailwind.css
│
└───routes
_index.tsx
This folder responsible all routes in remix project and recently its upgraded to v2. We see the structure soon in another post.
_index.tsx is responsible home page index file refer to homepage and its visible in /route .
Try to create more routes and see the file based routing
routes/
├── AboutUs.tsx // available on /aboutus
├── Dashboard.tsx // available on /dashboard
├── Profile.tsx // available on /profile
└── _index.tsx // available on /
firstProject/
├── app/
│ ├── components/ # Reusable components
│ │ ├── Header.tsx
│ │ ├── Footer.tsx
│ │ └── Button.tsx
│ ├── routes/ # Routes and pages
│ │ ├── index.tsx # Homepage
│ │ ├── about.tsx # About page
│ │ ├── dashboard/ # Nested routes
│ │ │ ├── index.tsx # Dashboard home
│ │ │ └── profile.tsx # Dashboard profile
│ │ └── auth/ # Authentication-related routes
│ │ ├── login.tsx
│ │ └── register.tsx
│ ├── styles/ # Global styles
│ │ ├── globals.css
│ │ └── theme.css
│ ├── utils/ # Utility functions and helpers
│ │ └── helpers.ts
│ ├── services/ # API services and integrations
│ │ └── api.ts
│ ├── context/ # Context API for state management
│ │ └── AuthContext.tsx
│ ├── root.tsx # Entry point for the app
│ ├── entry.client.tsx # Client-side entry point
│ ├── entry.server.tsx # Server-side entry point
│ └── remix.env.d.ts # Remix environment types
├── public/ # Static assets (served as is)
│ ├── images/
│ │ └── logo.png
│ ├── favicon.ico
│ └── robots.txt
├── .env # Environment variables
├── package.json # Dependencies and scripts
├── remix.config.js # Remix configuration
├── tailwind.config.js # Tailwind CSS configuration (if used)
└── tsconfig.json # TypeScript configuration
npm run dev //for running frontend server
node server.js //for running server
npm run build
You should now see a build
folder containing a server
folder (the server version of your app) and a client
folder (the browser version) with some build artifacts in them. (This is all configurable.)