Image Copyright Β© SAWARATSUKI. All rights reserved.
Image used under permission from the copyright holder.
This project provides a boilerplate for building RESTful APIs using Go. It is designed to a quick start with best practices, easy configuration, and a clear project structure.
Warning
This boilerplate is specifically tailored for extensive codebases and scalable RESTful API applications, along with frontend websites that may span multiple sites. Its design ensures scalability and straightforward maintenance, making it highly suitable for complex projects. However, it may not be the ideal choice for smaller-scale RESTful API applications or single-website frontends where such robust architecture is not required.
Tip
Given that this boilerplate focuses on high performance
(e.g., it can handle substantial workloads
), it is recommended to run and isolate
it on Kubernetes
. It has been tested alongside the worker package
and has proven to be fully stable
for low to high workloads (concurrency)
. Running and isolating
it on Kubernetes
allows for easy scaling when additional resources
, such as vCPUs
, are needed.
- Use Fiber Framework
- Pre-configured MySQL and Redis integration
- Middleware examples for logging and authentication
- Scalable project structure
- Dual-licensed under BSD 3-Clause and MIT (specific files)
- High Performance (Thanks to the
Sonic JSON serializing & deserializing library
) - Cryptography Techniques
- High Quality Go Codes
- Rich Presence TUIs using
charm.sh
Boring TLS 1.3 Protocol (WIP)-> EOL (No longer actively developed due to time constraints)Certificate Transparency (CT) Log-> EOL (No longer actively developed due to time constraints)
Note
Boring TLS 1.3 Protocol
This project utilizes the industry-standard TLS 1.3 protocol, known for its exceptional security and reliability. We call it Boring TLS
because its robust security makes it almost boring.
Note
Certificate Transparency (CT) Log
This project includes built-in support for submitting certificates to Certificate Transparency logs. It supports certificates with both RSA and ECDSA keys. By submitting certificates to CT logs, it enhances the security and transparency of the TLS ecosystem, allowing domain owners to monitor and detect fraudulent certificates or other bad certificates. The CT log functionality is implemented using the SubmitToCTLog
function, which takes the certificate, private key, and CT log details as input. It encodes the certificate, calculates the hash, creates a JSON payload, sends an HTTP request to the CT log server, and verifies the signed certificate timestamp (SCT) received in the response. The VerifySCT
method is responsible for verifying the SCT based on the public key type (RSA or ECDSA) and ensures the integrity of the timestamp. With this feature, it is easy to integrate certificate transparency into the TLS setup and contribute to a more secure web.
Warning
Some features might not work as expected when running this repo on certain cloud providers. For example, the Rich Presence TUIs
feature requires a tty
.
The reason why some features might not work as expected after implementation is because this repo is designed to be top-level
and follow the Unix philosophy
. Plus, most of the Go code
in this repo follows many best practices
and idioms from Effective Go
.
Tip
Due to the large codebase of this repository, which includes many sub-packages such as helper functions (lazy splitting into another repository), consider implementing your own or an alternative main
Go mechanism (follow best practices here
). This can be used across multiple containers in a single deployment for infrastructure purposes. Personally, I have created many such mechanisms for running in Kubernetes (k8s)
based on this starter repository.
Move here
Note
Additional features will be added later as my primary focus is on using this with the Fiber framework
and Cryptography Techniques
.
Note
The following list includes additional features that I've been using before for extremely scalable and high-performance applications:
The motivation for sharing this RESTful API Boilerplate on GitHub is to streamline my development process, ensuring I don't have to start from scratch each time. It's a robust, secure foundation that adheres to best practices, designed for quick and efficient project initiation.
This boilerplate is grounded in the Unix philosophy, emphasizing simplicity, modularity, and reusability. Each component is designed to do one thing and do it well, with the ability to combine components seamlessly to perform complex tasks. This approach ensures that the boilerplate remains lightweight, efficient, and easy to maintain.
MySQL
withoutRedis
100KPOST
Request (Outdated
-go1.22.2
)
Note
The Resource Memory Usage
section demonstrates how Go
has stable and low memory overhead compared to other languages, especially Java
(See this article for more information on Java memory management Lmao.) hahaha.
Idle
(Outdated
-go1.22.2
)
Note
The Idle
section demonstrates the memory usage when there is no request. The maximum average memory usage is around 21.5MB. Go routines (100 goroutines) along with a semaphore are used to automatically handle high traffic situations (e.g., lots of requests).
Also Note that even with high incoming traffic (e.g., 1 million requests
), the maximum average memory usage is still relatively low
, around 100MB
(e.g., 50MB
), due to the use of the semaphore
.
Idle
(Outdated
-go1.22.3
)
sample#memory_total=8.01MB
sample#memory_rss=7.92MB
sample#memory_cache=0.09MB
sample#memory_swap=0.00MB
sample#memory_pgpgin=0pages
sample#memory_pgpgout=0pages
sample#memory_quota=1024.00MB
Note
Go Memory Usage Improvements:
- The
Idle
memory usage in the latest version ofGo
has been optimized, reducing it to approximately7.92MB
compared to the previous version.
Average Memory Usage Breakdown:
- The average memory usage of
11.1MB
includes:- Go routine scheduler for database operations (separate from the 100 goroutines used for handling high incoming traffic automatically with a semaphore)
- Load for the
front-end
website - Load for the
REST APIs
(Full Stack
)
- The application remains stable without any performance issues, such as bottlenecks or memory leaks, and has zero vulnerabilities.
Go Performance Comparison:
- Compared to other languages, particularly for full-stack development,
Go
demonstrates superior performance.
Standard TLS 1.3
(Latest Go Version
-go1.22.5
)
Note
The screenshots provided demonstrate a Standard TLS 1.3
connection using the Closed networks or intranets
method, which involves Cloudflare (Frontend
) and Heroku (Backend
). Without Cloudflare, any browser or tools like curl won't be able to access the backend server.
Error Page
(Include Wildcard Handler
)
Note
The screenshot provided demonstrates the performance of an Error Page
, and it can easily be optimized to achieve all green metrics.
Tip
Also note that when optimized to achieve all green metrics which is easily, especially in the SEO category, it can be beneficial for business logic purposes. (e.g, Search engines like Google
and Microsoft Bing
tend to favor websites with good performance metrics, which can lead to improved search rankings and increased visibility.)
Latest Go Version
Note
The grafana
dashboard is not shareable due to it being bound to my security configurations for real-world monitoring in other production environments.
Below is the architecture of this boilerplate and how it looks. I created this for REST APIs about volcano π monitoring used by the government (has been done before), so it can easily monitor volcanoes in the real world.
- Backend (Pure
Go
)
backend/
|-- cmd/
| `-- server/ (main application entry point)
| `-- main.go
|-- pkg/
| |-- restapis/ (API route handlers)
| |-- any/ (any related code)
|-- internal/ (private application and library code)
| |-- any/ (any related code)
|-- .env (optional environment variables since it can placed anywhere)
`-- go.mod (dependencies)
- Frontend (Any Framework
TS
e.g, React,NextJS or pureJS
forHTMX
)
frontend/
|-- pages/
| |-- api/ (optional, for Next.js API routes if needed)
| |-- _app.js (global page layouts and state)
| |-- index.js (home page)
| `-- [...other pages]
|-- public/ (static files like images, fonts)
|-- src/
| |-- components/ (shared React components)
| | `-- [various components]
| |-- styles/ (global styles, theme)
| |-- hooks/ (custom React hooks)
| |-- utils/ (utility functions)
| |-- lib/ (libraries and configurations)
| `-- context/ (React context files for state management)
|-- .env.local (environment variables)
|-- next.config.js (Next.js configuration)
`-- package.json (dependencies and scripts)
βββ Dockerfile
βββ LICENSE
βββ README.md
βββ SECURITY.md
βββ backend
βΒ Β βββ cmd
βΒ Β βΒ Β βββ server
βΒ Β βΒ Β βββ run.go
βΒ Β βΒ Β βββ run_heroku.go
βΒ Β βΒ Β βββ run_immutable.go
βΒ Β βΒ Β βββ run_tls_fips.go
βΒ Β βββ internal
βΒ Β βΒ Β βββ database
βΒ Β βΒ Β βΒ Β βββ auth.go
βΒ Β βΒ Β βΒ Β βββ backup.go
βΒ Β βΒ Β βΒ Β βββ cloudflare-kv
βΒ Β βΒ Β βΒ Β βΒ Β βββ setup.go
βΒ Β βΒ Β βΒ Β βββ constant.go
βΒ Β βΒ Β βΒ Β βββ helper.go
βΒ Β βΒ Β βΒ Β βββ mysql_redis.go
βΒ Β βΒ Β βΒ Β βββ redis_json.go
βΒ Β βΒ Β βΒ Β βββ setup.go
βΒ Β βΒ Β βΒ Β βββ sql_injection_test.go
βΒ Β βΒ Β βΒ Β βββ tls.go
βΒ Β βΒ Β βββ logger
βΒ Β βΒ Β βΒ Β βββ constant.go
βΒ Β βΒ Β βΒ Β βββ logger.go
βΒ Β βΒ Β βββ middleware
βΒ Β βΒ Β βΒ Β βββ authentication
βΒ Β βΒ Β βΒ Β βΒ Β βββ crypto
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ bcrypt
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ bcrypt.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ bcrypt_test.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ compare_password.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ docs.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ hash_password.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ cipher.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ crypto.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ crypto_test.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ deadcode.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ decrypt.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ encrypt.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ gopherpocket
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ keyrotation
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ docs.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ gopherkey.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ gopherkey_test.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ gpg
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ benchmark_test.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ config.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ docs.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ encrypt.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ encrypt_test.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ file.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ key_info.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ key_ring.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ keybox.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ keybox_test.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ new.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ helper.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ hybrid
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ decryptcookie.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ encryptcookie.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ hybrid.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ hybrid_stream.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ hybrid_test.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ stream
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ benchmark_test.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ chunk.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ decrypt_stream.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ digest.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ docs.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ encrypt_stream.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ new_stream.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ nonce.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ stream_test.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ keyidentifier
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ docs.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ ecdsa_sign.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ generate.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ keyidentifier_test.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ new.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ rand
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ benchmark_test.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ fixed_size.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ rand_test.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ uuid.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ tls
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ docs.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ setup.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ vault
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ new.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ transit.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ web3
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ eth
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ docs.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ new.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ webauthn
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ docs.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ login.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ protocol.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ registration.go
βΒ Β βΒ Β βΒ Β βΒ Β βββ helper
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ constant.go
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ keyauth.go
βΒ Β βΒ Β βΒ Β βΒ Β βββ keyauth
βΒ Β βΒ Β βΒ Β βΒ Β βββ constant.go
βΒ Β βΒ Β βΒ Β βΒ Β βββ error.go
βΒ Β βΒ Β βΒ Β βΒ Β βββ success.go
βΒ Β βΒ Β βΒ Β βΒ Β βββ validator.go
βΒ Β βΒ Β βΒ Β βββ constant.go
βΒ Β βΒ Β βΒ Β βββ csp
βΒ Β βΒ Β βΒ Β βΒ Β βββ config.go
βΒ Β βΒ Β βΒ Β βΒ Β βββ csp_test.go
βΒ Β βΒ Β βΒ Β βΒ Β βββ new.go
βΒ Β βΒ Β βΒ Β βββ custom_logger_tag.go
βΒ Β βΒ Β βΒ Β βββ custom_next.go
βΒ Β βΒ Β βΒ Β βββ filesystem
βΒ Β βΒ Β βΒ Β βΒ Β βββ crypto
βΒ Β βΒ Β βΒ Β βΒ Β βββ signature
βΒ Β βΒ Β βΒ Β βΒ Β βββ hmac_sign.go
βΒ Β βΒ Β βΒ Β βΒ Β βββ hmac_test.go
βΒ Β βΒ Β βΒ Β βΒ Β βββ hmac_verify.go
βΒ Β βΒ Β βΒ Β βββ frontend_routes.go
βΒ Β βΒ Β βΒ Β βββ helper.go
βΒ Β βΒ Β βΒ Β βββ init.go
βΒ Β βΒ Β βΒ Β βββ lb_test.go
βΒ Β βΒ Β βΒ Β βββ monitor
βΒ Β βΒ Β βΒ Β βΒ Β βββ docs.go
βΒ Β βΒ Β βΒ Β βΒ Β βββ prometheus.go
βΒ Β βΒ Β βΒ Β βββ restapis_routes.go
βΒ Β βΒ Β βΒ Β βββ restime
βΒ Β βΒ Β βΒ Β βΒ Β βββ config.go
βΒ Β βΒ Β βΒ Β βΒ Β βββ new.go
βΒ Β βΒ Β βΒ Β βββ router
βΒ Β βΒ Β βΒ Β βΒ Β βββ domain
βΒ Β βΒ Β βΒ Β βΒ Β βββ config.go
βΒ Β βΒ Β βΒ Β βΒ Β βββ new.go
βΒ Β βΒ Β βΒ Β βββ routes.go
βΒ Β βΒ Β βΒ Β βββ routes_immutable.go
βΒ Β βΒ Β βΒ Β βββ routes_non_immutable.go
βΒ Β βΒ Β βΒ Β βββ storage.go
βΒ Β βΒ Β βΒ Β βββ utils.go
βΒ Β βΒ Β βββ server
βΒ Β βΒ Β βΒ Β βββ boringtls.go
βΒ Β βΒ Β βΒ Β βββ boringtls_cert.go
βΒ Β βΒ Β βΒ Β βββ boringtls_cert_test.go
βΒ Β βΒ Β βΒ Β βββ boringtls_test.go
βΒ Β βΒ Β βΒ Β βββ constant.go
βΒ Β βΒ Β βΒ Β βββ ct_verifier.go
βΒ Β βΒ Β βΒ Β βββ ct_verifier_test.go
βΒ Β βΒ Β βΒ Β βββ helper.go
βΒ Β βΒ Β βΒ Β βββ helper_tls_test.go
βΒ Β βΒ Β βΒ Β βββ k8s
βΒ Β βΒ Β βΒ Β βΒ Β βββ docs.go
βΒ Β βΒ Β βΒ Β βΒ Β βββ metrics
βΒ Β βΒ Β βΒ Β βΒ Β βββ prometheus.go
βΒ Β βΒ Β βΒ Β βββ mount_routes.go
βΒ Β βΒ Β βΒ Β βββ register_routes.go
βΒ Β βΒ Β βΒ Β βββ startup_async.go
βΒ Β βΒ Β βββ translate
βΒ Β βΒ Β βββ language.go
βΒ Β βββ pkg
βΒ Β βββ gc
βΒ Β βΒ Β βββ docs.go
βΒ Β βΒ Β βββ reduce_http_client_overhead.go
βΒ Β βΒ Β βββ reduce_overhead.go
βΒ Β βΒ Β βββ unique.go
βΒ Β βββ header
βΒ Β βΒ Β βββ htmx
βΒ Β βΒ Β βββ constant.go
βΒ Β βΒ Β βββ docs.go
βΒ Β βββ mime
βΒ Β βΒ Β βββ ascii.go
βΒ Β βΒ Β βββ docs.go
βΒ Β βΒ Β βββ mime.go
βΒ Β βββ restapis
βΒ Β βββ helper
βΒ Β βΒ Β βββ auth
βΒ Β βΒ Β βΒ Β βββ apikey.go
βΒ Β βΒ Β βΒ Β βββ constant.go
βΒ Β βΒ Β βββ generate_apikey.go
βΒ Β βΒ Β βββ generate_apikey_test.go
βΒ Β βΒ Β βββ json
βΒ Β βΒ Β βΒ Β βββ sonic
βΒ Β βΒ Β βΒ Β βββ config.go
βΒ Β βΒ Β βΒ Β βββ docs.go
βΒ Β βΒ Β βββ numeric.go
βΒ Β βΒ Β βββ numeric_test.go
βΒ Β βΒ Β βββ restapis_error.go
βΒ Β βΒ Β βββ restapis_error_test.go
βΒ Β βββ server
βΒ Β βββ health
βΒ Β βββ cache.go
βΒ Β βββ constant.go
βΒ Β βββ db.go
βΒ Β βββ helper.go
βΒ Β βββ mysql.go
βΒ Β βββ redis.go
βββ env
βΒ Β βββ docs.go
βΒ Β βββ env.go
βΒ Β βββ getenv.go
βββ frontend
βΒ Β βββ htmx
βΒ Β βΒ Β βββ error_page_handler
βΒ Β βΒ Β βΒ Β βββ 400.templ
βΒ Β βΒ Β βΒ Β βββ 400_templ.go
βΒ Β βΒ Β βΒ Β βββ 401.templ
βΒ Β βΒ Β βΒ Β βββ 401_templ.go
βΒ Β βΒ Β βΒ Β βββ 403.templ
βΒ Β βΒ Β βΒ Β βββ 403_templ.go
βΒ Β βΒ Β βΒ Β βββ 404.templ
βΒ Β βΒ Β βΒ Β βββ 404_templ.go
βΒ Β βΒ Β βΒ Β βββ 500.templ
βΒ Β βΒ Β βΒ Β βββ 500_templ.go
βΒ Β βΒ Β βΒ Β βββ 503.templ
βΒ Β βΒ Β βΒ Β βββ 503_templ.go
βΒ Β βΒ Β βΒ Β βββ base.templ
βΒ Β βΒ Β βΒ Β βββ base_templ.go
βΒ Β βΒ Β βΒ Β βββ page_handler.go
βΒ Β βΒ Β βΒ Β βββ render_frontend.go
βΒ Β βΒ Β βΒ Β βββ static_handler.go
βΒ Β βΒ Β βββ public
βΒ Β βΒ Β βΒ Β βββ assets
βΒ Β βΒ Β βΒ Β βββ css
βΒ Β βΒ Β βΒ Β βββ base-tailwind.css
βΒ Β βΒ Β βββ site
βΒ Β βΒ Β βββ footer.templ
βΒ Β βΒ Β βββ footer_templ.go
βΒ Β βΒ Β βββ head.templ
βΒ Β βΒ Β βββ head_templ.go
βΒ Β βΒ Β βββ header.templ
βΒ Β βΒ Β βββ header_templ.go
βΒ Β βΒ Β βββ script.templ
βΒ Β βΒ Β βββ script_templ.go
βΒ Β βββ public
βΒ Β βββ assets
βΒ Β βΒ Β βββ css
βΒ Β βΒ Β βΒ Β βββ base-tailwind.css
βΒ Β βΒ Β βΒ Β βββ raw.css
βΒ Β βΒ Β βββ images
βΒ Β βΒ Β βΒ Β βββ android-chrome-192x192.png
βΒ Β βΒ Β βΒ Β βββ android-chrome-512x512.png
βΒ Β βΒ Β βΒ Β βββ apple-touch-icon.png
βΒ Β βΒ Β βΒ Β βββ browserconfig.xml
βΒ Β βΒ Β βΒ Β βββ favicon-16x16.png
βΒ Β βΒ Β βΒ Β βββ favicon-32x32.png
βΒ Β βΒ Β βΒ Β βββ favicon.ico
βΒ Β βΒ Β βΒ Β βββ http_error_codes
βΒ Β βΒ Β βΒ Β βΒ Β βββ 403-Forbidden.png
βΒ Β βΒ Β βΒ Β βΒ Β βββ 404-NotFound.png
βΒ Β βΒ Β βΒ Β βΒ Β βββ 500-InternalServerError.png
βΒ Β βΒ Β βΒ Β βΒ Β βββ 503-ServiceUnavailable.png
βΒ Β βΒ Β βΒ Β βββ logo
βΒ Β βΒ Β βΒ Β βΒ Β βββ gopher-run.png
βΒ Β βΒ Β βΒ Β βββ mstile-150x150.png
βΒ Β βΒ Β βΒ Β βββ safari-pinned-tab.svg
βΒ Β βΒ Β βΒ Β βββ site.webmanifest
βΒ Β βΒ Β βββ js
βΒ Β βΒ Β βββ htmx.indicator.min.js
βΒ Β βΒ Β βββ htmx.min.js
βΒ Β βΒ Β βββ tailwind.min.dark.js
βΒ Β βββ magic_embedded.go
βββ gcloud-builds.yaml
βββ go.mod
βββ go.sum
βββ k8s-deployment
βΒ Β βββ MySQL.md
βΒ Β βββ README.md
βΒ Β βββ REDIS.md
βΒ Β βββ RESTAPIs.md
βΒ Β βββ component
βΒ Β βΒ Β βββ coredns
βΒ Β βΒ Β βΒ Β βββ coredns-hpa.yaml
βΒ Β βΒ Β βββ secrets
βΒ Β βΒ Β βββ create_k8s_secret.sh
βΒ Β βββ mysql-deploy-cpu-boost.yaml
βΒ Β βββ mysql-deploy.yaml
βΒ Β βββ mysql-storage-eks.yaml
βΒ Β βββ mysql-storage-gke.yaml
βΒ Β βββ prometheus_portable.yaml
βΒ Β βββ prometheus_portable_rules_record.yaml
βΒ Β βββ redis-insight.yaml
βΒ Β βββ restapis-deploy.yaml
βΒ Β βββ restapis-ingress.yaml
βΒ Β βββ traffic
βΒ Β βββ nginx
βΒ Β βββ ingress-nginx-configmap.yaml
βΒ Β βββ ingress-nginx-hpa.yaml
βΒ Β βββ ingress-nginx-priority.yaml
βΒ Β βββ ingress-nginx-vpa.yaml
βββ tailwind.config.js
βββ translate.json
βββ worker
βββ config.go
βββ do_work.go
βββ docs.go
βββ jobs.go
βββ token_bucket.go
βββ worker_test.go
72 directories, 230 files
Note
The Current Boilerplate Tree
is designed as a modular framework
, and it is easily maintainable even if it reaches 1K files. Personally, I've been maintaining over 1k files as well
from this boilerplate, and it runs smoothly on Kubernetes (K8s) β΅ βΈ.
Server Location: Singapore (Stable and very low latency for Southeast Asian Regions
, ranging from 10ms ~ 50ms
)
git clone https://git.b0zal.io/H0llyW00dzZ/My-RESTAPIs-Boilerplate.git
Note
Server Management and Isolation by Kubernetes:
- The
Storage
is secure and fully encrypted (end-to-end
), designed with flexibility in mind. It is suitable forautomated attach/detach
processes within acluster
. - The
Network
utilizes anetwork load balancer
controlled byIngress Nginx
, optimizing latency for theAPAC
region, ensuring smooth sailing β΅ βΈ. - The
Git SSH
should function properly as it utilizes theTCP Service Nginx
. It isfully secured
, making it resistant tobrute-force attacks
andexploits
due to itsunderlying logic
, which incorporatesElliptic Curve Cryptography (ECC)
.
Tip
For those in Indonesia
, if you are unable to clone repositories (e.g., using git clone
) from the Git Mirror (Auto Synced)
, try using a VPN. This issue may be related to the new load balancer, which could be blocked (by internet provider) or filtered by my firewall mechanism.
It is also more faster with the new load balancer, even when using a VPN (e.g., VPN in Singapore, Indonesia, Malaysia, and other APAC regions
), and this improvement applies to both mobile devices and desktops
, which incorporate Elliptic Curve Cryptography (ECC)
for HTTPS/TLS
.
Due to the use of Sonic JSON for encoding/decoding, this boilerplate supports only the following architectures:
AMD64
ARM64
Note
It can also be ideal for multi-architecture
workloads.
This project is dual-licensed under the BSD 3-Clause License and the MIT License - see the LICENSE file for details.