Nextauri is your favorite template for create cross-platform application using `Tauri` with `Next.js`. <br/>
It came with minimal best practice setup so you can add anything fit your need. <br/>
You can it use to develop `Windows`, `Linux` and `Mac` desktop application. <br/>
But Tauri plan to have a mobile compatibility in the futur !
## ✨ Key Features
Nextauri integrates community-endorsed best practices with powerful tooling out of the box:
### Code Quality Assurance
- Community-recommended ESLint configuration for Next.js projects
- Rust best practices enforced through Clippy linter for Tauri
### Automated CI/CD Pipeline
- GitHub Actions workflows that trigger when pushing and creating pull request:
- Next.js project linting with ESLint
- Tauri project analysis with Clippy
- Production builds for all platforms:
• Linux
• Windows
• macOS
### Maintenance Automation
- Automated weekly dependency updates keeping your stack fresh
## 💪 Motivation
Tauri is great to make secure cross platform application backed by `Rust` ! <br/>
It will load an `HTML` page inside a `Webview` and give the ability to do system call with `IPC`. <br/>
If you are familliar with `electron` or `nextron` you can see it as a very good replacement with smaller bundle size, smaller memory usage and more secure.
That make Next.js the perfect fit for bundle React application with Tauri since it comes with great Static-Site Generation `SSG` capability that will allow us to generates static files that will be included in the final binary.
The `benefit` of using Next.js `SSG` mode is pre-rendered React code in static HTML/JavaScript. <br/> This means your app will load faster. <br/>
React doesn't have to render the `HTML` on the client-side but will hydrate it on the first load if needed.
The `downside` is that we cannot use `getServerSideProps` or use any type of `data fetching` for rendering our page for a request. <br/>
Instead we will use `getStaticProps` to generate our page at build time. <br/>
Note that if you still want the power of `Rust` for generate your page you may have a look at [Neon](https://neon-bindings.com). <br/>
It will allow you to call `Rust` code from Node.js !
## 📦 Installation
Be sure you have [NodeJS](https://nodejs.org/en/) and [Rust](https://www.rust-lang.org/) installed on your system
1. See Tauri [prerequisites](https://tauri.app/v1/guides/getting-started/prerequisites/) to prepare your system to build `Tauri`
This will start both Tauri and Next.js in development mode.
> Note that tauri is waiting for an http server to be alive on localhost:3000. <br />
> It's the default Next.js `port` while running in development
You can modify the `port` by updating `src-tauri/tauri.conf.json`. <br/>
```json
"beforeDevCommand": "npm run next dev -- -p 8080",
"devPath": "http://localhost:8080",
```
### Source structure
-`src-next/` are where Next.js files are located.
-`src-tauri/` contain Tauri source files.
## 🧪 Testing
To test your application we recommand you to use [Cypress](https://www.cypress.io) using Tauri [mocking technique](https://tauri.app/v1/guides/testing/mocking).
In general to safely invoke `Tauri API` you should use it in `componentDidMount`, `useEffect` or on user based `events` that will be alway executed in client side.
## 📚 Documentation
To learn more about Tauri and Next.js, take a look at the following resources:
- [Tauri Guides](https://tauri.app/v1/guides/) - guide about Tauri.