Quick Start Guide

Get up and running with Squirrel in minutes. This guide will walk you through creating your first web server.

CLIGo 1.19+5 minutes
1Create a New Project
Initialize a new Go module for your Squirrel application
mkdir my-squirrel-app
cd my-squirrel-app
go mod init my-squirrel-app
2Install Squirrel
Add Squirrel as a dependency to your project
go get github.com/squirrel-land/squirrel
3Create Your First Server
Write a simple HTTP server using Squirrel

Create a file called main.go and add the following code:

package main

import (
    "fmt"
    "log"
    "net/http"
    
    "github.com/squirrel-land/squirrel"
)

func main() {
    // Create a new Squirrel mux
    mux := squirrel.NewSqurlMux()
    
    // Add a simple route
    mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
        fmt.Fprintf(w, "Hello, Squirrel! 🐿️")
    })
    
    // Add another route with path parameters
    mux.HandleFunc("/user/{id}", func(w http.ResponseWriter, r *http.Request) {
        id := squirrel.GetParam(r, "id")
        fmt.Fprintf(w, "User ID: %s", id)
    })
    
    // Start the server
    fmt.Println("Server starting on :8080")
    log.Fatal(http.ListenAndServe(":8080", mux))
}
4Run Your Server
Start your Squirrel application
go run main.go

Your server should now be running on http://localhost:8080. Try visiting the following URLs:

  • http://localhost:8080/ - Hello message
  • http://localhost:8080/user/123 - User with ID 123
🎉 Congratulations!
Youve successfully created your first Squirrel web server

You now have a working web server with:

  • Basic routing
  • Path parameters
  • HTTP request handling
Next Steps
Continue learning with these guides

Routing Guide

Learn advanced routing patterns and techniques

Read the guide →

Middleware

Add authentication, logging, and more

Learn middleware →

API Reference

Explore all available functions and types

View API docs →

Examples

See real-world applications and patterns

Browse examples →