chore: rename simple_bank to api_tmpl and clean up for template use

Rename the module, proto service, and all identifiers from simple_bank/
SimpleBank to api_tmpl/ApiTmpl, and regenerate the gRPC/gateway/swagger/
mock code accordingly.

- Scrub real secrets (SMTP password, auth token secret) from api.env/
  api_test.env, untrack them, and add api.env.example/api_test.env.example
- Remove committed build artifacts (tmp/main, tmp/build-errors.log,
  dbml-error.log) and gitignore them going forward
- Fix Dockerfile paths (build target, migrations copy) that referenced a
  stale project layout
- Rewrite README to match the actual cmd/ + internal/ structure and add a
  "using this as a template" section
This commit is contained in:
FernandoJVideira committed 2026-08-25 03:02:37 +01:00
1 parent 961bdd81d4
commit c4ee0ce4dc
71 files changed
+744 -743

No files matched your search

+15 -15
View File
@@ -15,15 +15,15 @@ import (
"github.com/rs/zerolog/log"
"golang.org/x/sync/errgroup"
"github.com/FernandoJVideira/simple_bank/internal/auth"
"github.com/FernandoJVideira/simple_bank/internal/config"
db "github.com/FernandoJVideira/simple_bank/internal/db/sqlc"
gapi "github.com/FernandoJVideira/simple_bank/internal/handlers/grpc"
api "github.com/FernandoJVideira/simple_bank/internal/handlers/http"
"github.com/FernandoJVideira/simple_bank/internal/mailer"
"github.com/FernandoJVideira/simple_bank/internal/service"
"github.com/FernandoJVideira/simple_bank/internal/worker"
"github.com/FernandoJVideira/simple_bank/pb"
"github.com/FernandoJVideira/api_tmpl/internal/auth"
"github.com/FernandoJVideira/api_tmpl/internal/config"
db "github.com/FernandoJVideira/api_tmpl/internal/db/sqlc"
gapi "github.com/FernandoJVideira/api_tmpl/internal/handlers/grpc"
api "github.com/FernandoJVideira/api_tmpl/internal/handlers/http"
"github.com/FernandoJVideira/api_tmpl/internal/mailer"
"github.com/FernandoJVideira/api_tmpl/internal/service"
"github.com/FernandoJVideira/api_tmpl/internal/worker"
"github.com/FernandoJVideira/api_tmpl/pb"
"github.com/golang-migrate/migrate/v4"
_ "github.com/golang-migrate/migrate/v4/database/postgres"
@@ -36,7 +36,7 @@ import (
"google.golang.org/grpc/reflection"
"google.golang.org/protobuf/encoding/protojson"
_ "github.com/FernandoJVideira/simple_bank/docs/statik"
_ "github.com/FernandoJVideira/api_tmpl/docs/statik"
)
var interruptSignals = []os.Signal{
@@ -45,13 +45,13 @@ var interruptSignals = []os.Signal{
syscall.SIGINT,
}
// @title Simple Bank API
// @title API Template
// @version 1.0
// @description API for Simple Bank application
// @description Backend API template service
// @termsOfService http://swagger.io/terms/
// @contact.name API Support
// @contact.email support@simplebank.com
// @contact.email support@example.com
// @license.name MIT
// @license.url https://opensource.org/licenses/MIT
@@ -181,7 +181,7 @@ func runGrpcServer(ctx context.Context, wg *errgroup.Group, config config.Config
grpcLogger := grpc.UnaryInterceptor(gapi.GrpcLogger)
grpcServer := grpc.NewServer(grpcLogger)
pb.RegisterSimpleBankServer(grpcServer, server)
pb.RegisterApiTmplServer(grpcServer, server)
reflection.Register(grpcServer)
listener, err := net.Listen("tcp", config.GrpcServerAddr)
@@ -228,7 +228,7 @@ func runGatewayServer(ctx context.Context, wg *errgroup.Group, config config.Con
grpcMux := runtime.NewServeMux(opts)
err = pb.RegisterSimpleBankHandlerServer(ctx, grpcMux, server)
err = pb.RegisterApiTmplHandlerServer(ctx, grpcMux, server)
if err != nil {
log.Fatal().Err(err).Msg("cannot register handler server")
}