Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
github.com/adityarizkyramadhan/template-go-mvc
Welcome to the Golang MVC Project Template! This repository serves as a starting point for building scalable, maintainable, and clean Go applications using the Model-View-Controller (MVC) architecture. The template is designed with flexibility in mind, integrating essential components such as Redis, PostgreSQL, Swagger, and more.
The project is organized as follows:
├── controllers
│ └── # Handlers for managing HTTP requests
├── database
│ ├── redis.go # Redis setup and connection
│ └── postgre.go # PostgreSQL setup and connection
├── docs
│ └── # Swagger documentation files
├── logs
│ └── # Log files directory
├── middleware
│ └── # Middleware functions for request processing
├── model
│ └── # Model representations of database entities
├── repositories
│ └── # Database interaction and business logic
├── routes
│ └── # API route definitions
├── seeder
│ └── # Data seeding scripts
├── storage
│ └── # File storage directory
├── utils
│ └── # Utility functions and helpers
└── main.go
└── # Application entry point
controllers/
The controllers
directory is where you define your request handlers. These handlers are responsible for managing the flow of data between the client and the server, utilizing the services provided by the repositories
layer.
database/
The database
directory contains setup and connection logic for the databases used in the application. This template integrates both Redis and PostgreSQL to handle caching and persistent data storage, respectively.
redis.go
: Handles Redis setup and connection.postgre.go
: Manages PostgreSQL setup and connection.docs/
The docs
directory is reserved for API documentation generated using Swagger. This allows you to maintain and share your API specifications in a standardized format, making it easier for others to understand and use your API.
logs/
The logs
directory is where all log files are stored. Logging is essential for monitoring and debugging the application, and this directory keeps all logs organized and accessible.
middleware/
The middleware
directory contains functions that are executed before your controllers handle a request. Middleware can be used for tasks like authentication, logging, and request validation.
repositories/
The repositories
directory is where you manage interactions with the database. This layer abstracts the data access logic, allowing your application to interact with the database in a clean and organized way. Business logic that involves database operations is also placed here.
routes/
The routes
directory is where you define your API routes. It acts as the mapping layer between HTTP requests and the appropriate controller functions, keeping your routing logic clean and maintainable.
seeder/
The seeder
directory contains scripts for seeding the database with initial data. This is particularly useful during development and testing to ensure your application has the necessary data to run.
storage/
The storage
directory is used for storing files, such as uploaded files, images, and other persistent data that doesn't belong in a database.
utils/
The utils
directory houses utility functions and helpers that can be reused across the application. These are typically small, generic functions that simplify repetitive tasks.
main.go
The main.go
file is the entry point of the application. It initializes the application, sets up routes, middleware, and database connections, and starts the server.
To get started with this template:
Clone the repository:
git clone https://github.com/adityarizkyramadhan/template-go-mvc
Install the required dependencies:
go mod tidy
Set up your environment variables:
.env
file in the root directory..env.example
file for a list of required variables.Run the application:
go run main.go
Contributions are welcome! If you have any suggestions, bug reports, or feature requests, feel free to open an issue or create a pull request.
This project is unliscensed.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.