More Premium Hugo Themes Premium Nextjs Themes

Scala3 Nextjs Template

A template repository using Scala 3, Next.js, scalajs-react, and showcasing code sharing between the front end and the JVM

Scala3 Nextjs Template

A template repository using Scala 3, Next.js, scalajs-react, and showcasing code sharing between the front end and the JVM

Author Avatar Theme by gbogard
Github Stars Github Stars: 31
Last Commit Last Commit: Oct 26, 2021 -
First Commit Created: Jun 19, 2023 -
Scala3 Nextjs Template screenshot

Overview

The Scala 3 / NextJS Starter is a template that combines the Scala 3 programming language with the Next.js framework and Tailwind CSS. It provides a Next.js web application using Scala 3 and scalajs-react, with full Tailwind v2 configuration and additional features like the NextApp sbt plugin for adding more Next.js sub-projects if needed. It also includes a server sbt project for server-side logic and a shared sbt project for code sharing between the Next.js app and the back end.

Features

  • Next.js web application using Scala 3 and scalajs-react
  • Full Tailwind v2 configuration with autoprefixer, purge-css, and cssnano
  • NextApp sbt plugin for adding more Next.js sub-projects
  • Server sbt project for server-side logic, preconfigured with sbt-revolver
  • Shared sbt project for code sharing between Next.js app and back end (e.g., Tapir endpoints)

Installation

To set up the Scala 3 / NextJS Starter, follow these steps:

  1. Install node dependencies:

    npm install
    

    Alternatively, you can run it directly from sbt, from the root repository:

    sbt;project root;npmInstall
    

    Note: Running external commands from sbt may be slower than running them from a terminal.

  2. Launch the Next.js development server:

    npm run dev
    

    Alternatively, if you prefer to run everything from sbt, the NextApp plugin provides several sbt commands:

    • startNextServer to start the development server in the background. Does nothing if the server is already running.
    • stopNextServer to stop the development server.
    • show nextServerIsRunning to check if the development server is running.
  3. Build the JavaScript from Scala.js and watch for changes. Run the following command in another terminal:

    sbt;project frontend;~fastOptJS
    
  4. For production build, follow these steps:

    1. Build the JavaScript from Scala.js with full optimization:

      sbt;project frontend;fullOptJS
      
    2. Build the Next.js app:

      npm run build
      

    Alternatively, you can run the production build from sbt using the following command:

    sbt;project root;deploy
    

Summary

The Scala 3 / NextJS Starter is a template that combines the Scala 3 programming language, Next.js framework, and Tailwind CSS to provide a convenient starting point for developing web applications. It offers features like a Next.js web application using Scala 3 and scalajs-react, full Tailwind v2 configuration, and plugins for managing Next.js sub-projects and server-side logic. The installation process involves setting up node dependencies, launching the development server, and building the JavaScript from Scala.js. Overall, this template aims to simplify the development process while leveraging the capabilities of Scala 3, Next.js, and Tailwind CSS.