Skip to content

intelliconnect/rust-standard-template

Repository files navigation

Rust API Template: Developer Environment Setup

To ensure a smooth onboarding experience and consistent development practices, follow the instructions below to set up your Rust development environment. This guide lists the essential tools and recommended Visual Studio Code (VS Code) extensions for working with this standardized Rust API template.


1. Install Rust Toolchain

  • Rustup: The official Rust toolchain installer. Install by running:
    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  • This will install rustc (the compiler), cargo (the package manager), and other core tools.

Recommended VS Code Extensions for Rust Development

Below is a table of recommended Visual Studio Code extensions for your Rust API project, each with a direct link to its Marketplace page for easy installation:

Extension Name Marketplace Link Purpose
Rust Analyzer rust-lang.rust-analyzer Core Rust language support: code navigation, completion, diagnostics, and more.
Dependi fill-labs.dependi Dependency management and visualization.
Dotenv (mikestead) mikestead.dotenv Syntax highlighting and support for .env files[4].
Dotenv Official (with Vault) dotenv.dotenv-vscode Advanced .env file management and syncing[5].
Even Better TOML tamasfe.even-better-toml TOML file syntax highlighting and validation[6].
GitHub Actions GitHub.vscode-github-actions View/manage GitHub Actions and build status.
GitHub Copilot GitHub.copilot AI code completion and suggestions.
GitHub Copilot Chat GitHub.copilot-chat Chat-based prompts AI coding assistant.
GitHub Pull Requests & Issues GitHub.vscode-pull-request-github Manage pull requests and issues from within VS Code without commands.
Codium Codium.codium AI coding assistant alternative to copilot.

Install these extensions by searching for their names in the VS Code Extensions Marketplace or by clicking the provided links. This setup will help ensure a robust and productive Rust development environment.


3. Project Conventions


4. Git Hooks Setup and Code Quality Checks

Quick Setup

Run this once after cloning:

.\git_hooks_setup.ps1

Done. Git will now automatically check your code before each commit.

What Gets Checked

  • Branch names - Must follow <type>/<name> format (e.g., feature/add-login)
  • Commit messages - Must follow <type>: description format (e.g., feat: add login)
  • Code quality - Runs cargo clippy to catch Rust mistakes
  • File names - No weird Unicode characters
  • Whitespace - No trailing spaces

Branch Types

feature/ bugfix/ hotfix/ release/ add/ refactor/

Example:

git checkout -b feature/add-expense-tracking

Commit Types

feat fix chore docs style refactor test perf ci

Example:

git commit -m "feat: add two-factor authentication"

Troubleshooting

Hooks not running?

git config core.hooksPath

Should show git-hooks. If not, run setup script again.

"Permission denied" error?

git update-index --chmod=+x .scripts/check-branch-name.sh
git update-index --chmod=+x .scripts/check-commit-msg.sh
git update-index --chmod=+x git-hooks/pre-commit

Need to skip checks?

git commit --no-verify -m "message"

(Don't make this a habit!)


Code Formatting

Format your code regularly:

cargo fmt

5. Quick Start

  1. Clone the repository and open it in VS Code.
  2. Ensure all recommended extensions are installed.
  3. Build and run the project:
    cargo build
    cargo run
  4. Use cargo clippy and cargo fmt regularly to maintain code quality.

6. Additional Resources


By following these steps and using the listed tools, you will have a robust and productive Rust development environment tailored for standardized API projects.

Disclaimer:

This project and its accompanying installation documentation are provided "as is" without any warranties or guarantees of any kind, either express or implied. While we have made every effort to ensure the accuracy and functionality of the code and instructions provided, we cannot guarantee that this solution will work in all environments or configurations. Use of this project is at your own risk. We are not responsible for any issues, damages, or data loss that may occur as a result of using this project or following the installation instructions. It is strongly recommended that you thoroughly test the solution in a non-production environment before deploying it to your production systems. Additionally, ensure that your environment meets all prerequisites and that you have the appropriate expertise to manage and troubleshoot any issues that may arise. By using this project, you acknowledge and agree to the terms of this disclaimer.

About

IntelliconnectQ Rust Axum REST API Template

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors