Local Installation
Set up Utopia on your local machine to contribute to development, customize the fleet builder, or work with the ship data offline.Prerequisites
Before installing Utopia, ensure you have the following tools installed:Install Node.js
Utopia requires Node.js for building and running the development environment.Download and install Node.js from nodejs.orgVerify your installation:
Installation Steps
Clone the Repository
Clone the Utopia repository from GitHub:This downloads the complete source code and project history.
Install Dependencies
Install all required npm packages:This command downloads and installs:
- Build tools (Grunt plugins)
- AngularJS and dependencies
- Development utilities
Build the Application
Generate the application files:This runs the default Grunt task which:
- Compiles Angular templates
- Minifies JavaScript files
- Processes and minifies CSS
- Generates the ship data JSON
- Copies assets to the
staw-utopiadirectory
staw-utopia/ directory.View Your Local Build
Open Then open http://localhost:8000 in your browser.
staw-utopia/index.html in your web browser to view the fleet builder.Alternatively, serve it with a local web server:Project Structure
Understanding the directory structure will help you navigate the codebase:Development Workflow
Watch Mode
For active development, use watch mode to automatically rebuild when files change:Development with Auto-Build
Combine initial build with watch mode:npm start followed by npm run watch.
Working with Ship Data
The ship and card data resides insrc/data/. To work with the data:
staw-utopia/data/data.json file contains the compiled ship database.
To inspect the generated
data.json file, use a JSON prettifier tool. The raw file is minified and difficult to read.Available Scripts
Utopia provides several npm scripts for common tasks:| Script | Command | Description |
|---|---|---|
| Build | npm start or npm run build | Build the complete application |
| Watch | npm run watch | Watch for changes and rebuild automatically |
| Dev | npm run dev | Build and start watch mode |
| Serve | npm run serve | Build and serve on http://localhost:8000 |
| Data | npm run data | Lint and generate ship data |
| Lint Data | npm run lint-data | Validate ship data files |
| Generate Data | npm run generate-data | Compile ship data to JSON |
Build Tasks
Grunt organizes the build into specific tasks:Troubleshooting
Build Fails
If the build fails:- Ensure all prerequisites are installed
- Delete
node_modules/and runnpm installagain - Check that you’re using a compatible Node.js version
- Review the error message for specific issues
Watch Mode Not Working
If watch mode doesn’t detect changes:- Ensure you’re editing files in
src/, notstaw-utopia/ - Try stopping and restarting watch mode
- Check file permissions
Port Already in Use
If port 8000 is already in use when runningnpm run serve:
The
http-server package is included as a dev dependency. If you prefer a different server, you can use any static file server.Next Steps
Now that you have Utopia running locally:- Explore the source code in
src/ - Make changes and test them locally
- Review the ship data format in
src/data/ - Consider contributing improvements back to the project
Data Schema
Explore the codebase structure and data models
Contributing Guide
Learn how to contribute to Utopia