Before creating your first spark project, you should ensure that your local machine has:
Once you have the .NET 7 SDK installed, you will also need Entity Framework Core tools. This can be installed with a simple
dotnet command in your terminal:
dotnet tool install --global dotnet-ef
After you have installed the required dependencies, you will need to install the Spark CLI.
# Install the Spark CLI dotnet tool install --global Spark.CLI
Then using the Spark CLI, install the Spark project templates.
# Install Spark's project templates spark install
You are now ready to create your first Spark project!
# Create your first Spark project spark new MyApp
Spark comes with several project templates to choose from. You can choose to generate your project with a certain template by providing the
spark new MyApp -t blazor
spark new MyApp -t api
To read more about project templates, check out our documentation here
Now that your project has been created, cd into the root folder and run
cd MyApp npm install
You can now create and run your first database migration. This will create the User tables for authentication that comes with a fresh Spark project.
spark make migration User spark migrate
Open your Spark project in the console by using Spark’s
open command. This will open it with your default IDE.
Finally, start .NET’s local development server using the dotnet watch command:
The easiest way to update the Spark CLI is to uninstall and reinstall it.
dotnet tool uninstall -g Spark.CLI dotnet tool install -g Spark.CLI
To update Spark’s project templates, simply run the spark update command in your console.