{"id":21231190,"url":"https://github.com/clemlak/solidity-project-template","last_synced_at":"2026-05-04T16:37:33.629Z","repository":{"id":101905831,"uuid":"141225333","full_name":"clemlak/solidity-project-template","owner":"clemlak","description":"A simple project template, created to quickly start new Solidity projects.","archived":false,"fork":false,"pushed_at":"2018-07-17T03:28:19.000Z","size":40,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-15T02:23:27.379Z","etag":null,"topics":["blockchain","ethereum","ethereum-contract","ethereum-dapp","project","project-template","smart-contracts","solidity","template"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/clemlak.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-17T03:19:29.000Z","updated_at":"2018-07-17T03:28:20.000Z","dependencies_parsed_at":"2023-04-29T11:46:44.490Z","dependency_job_id":null,"html_url":"https://github.com/clemlak/solidity-project-template","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/clemlak/solidity-project-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clemlak%2Fsolidity-project-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clemlak%2Fsolidity-project-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clemlak%2Fsolidity-project-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clemlak%2Fsolidity-project-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clemlak","download_url":"https://codeload.github.com/clemlak/solidity-project-template/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clemlak%2Fsolidity-project-template/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32616165,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-04T10:08:07.713Z","status":"ssl_error","status_checked_at":"2026-05-04T10:08:02.005Z","response_time":58,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blockchain","ethereum","ethereum-contract","ethereum-dapp","project","project-template","smart-contracts","solidity","template"],"created_at":"2024-11-20T23:41:15.798Z","updated_at":"2026-05-04T16:37:33.601Z","avatar_url":"https://github.com/clemlak.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Solidity Project Template\nThis package provides a simple project template, created to quickly start new Solidity projects.\n\nHere is  an explanation on how to configure this project template, and a quick guide on how to use it.\n\n## Before you begin\nFirst of all, please be sure that `npm` is installed on your computer, or [install it](https://www.npmjs.com/get-npm).\n\nWe use [Truffle](https://github.com/trufflesuite) and [Solhint](https://github.com/protofire/solhint) to facilitate the development of our projects. If you don't have them yet, we recommend you to install them globally:\n\n    npm install -g truffle\n    npm install -g solhint\n\n*Note: MacOS users may need to run these commands starting with `sudo`, for example: `sudo npm install -g truffle`.*\n\nAlso, [Infura](https://infura.io/) is used to migrate our contracts on the Ropsten network or the Live network. Don't forget to create your own account for future deployments.\n\n## Project overview\n\n### `contracts` folder\nYou should put all your contracts (`.sol` files) in this folder. At this point, the `contracts` folder has 3 files:\n\n- `Template.sol`: Just a basic contract as an example\n- `.solhint.json`: This is our [Solhint](https://github.com/protofire/solhint) configuration file, we'll talk about this later\n- `Migrations.sol`: This file helps us to migrate our contracts. Warning: **DO NOT** delete it!\n\n### `migrations` folder\nThe `migrations` folder contains 2 files: `1_initial_migration.js` and `2_deploy_contracts.js`. We will configure the second one later.\n\n### `test` folder\nAll our tests will go in the `test` folder. As an example, we created a `template.test.js` file.\n\n### `truffle.js` file\nThis file contains all the configuration related to our Truffle project. We already configured this file, but we'll talk later about some possible tweaks. Also, if you want to learn more about it, you can read [this page](https://truffleframework.com/docs/advanced/configuration).\n\n## Installation\n### Clone the project template\nThe first thing to do is to clone this repository:\n\n    git clone solidity-project-template my-project\n\n\nThen, change the current working directory to your project and install all the dependencies:\n\n    cd my-project\n    npm install\n\nWe decided to include the following packages in our project template:\n\n - [Dotenv](https://github.com/motdotla/dotenv): to use environment variables\n - [Open Zeppelin Solidity](https://github.com/OpenZeppelin/openzeppelin-solidity): very useful (and tested) Solidity libraries\n - [Truffle Hdwallet Provider](https://github.com/trufflesuite/truffle-hdwallet-provider): to sign transactions for addresses derived from a 12-word mnemonic (useful to deploy our contracts)\n\n### Configure the `package.json` file\nThe `package.json` (and `package-lock.json`) file contains all the information about your project, such as the name, the author, etc. Don't forget to change them!\n\n### Setup our environment variables\nWe use [Dotenv](https://github.com/motdotla/dotenv) in this project to protect our [Infura](https://infura.io/) API key and our mnemonic. The first thing you need to do is to create a `.env` file at the root of your project directory and include the following:\n\n    MNEMONIC=MY_MNEMONIC\n    INFURA=MY_INFURA_API_KEY\nOnce it's done, these values will be available in your project with `process.env.MNEMONIC` and `process.env.INFURA`. For example, we use these values in the `truffle.json` file to deploy our contracts to the Ropsten network or to the Live network.\n\n*Note: We added the `.env` file to our `.gitignore`, please be sure to **NEVER** commit this file.*\n\n*Note 2: Infura API key is only needed if you plan on deploying on networks such as Mainnet, Ropsten, Kovan, ...*\n\n### `truffle.json` configuration\nThis file contains all the parameters related our Truffle project (migration, test, solc, ...). We already configure it to suit our needs, so you don't have to change it!\n\nIf you want to learn more about this file, you can go [here](https://truffleframework.com/docs/advanced/configuration).\n\n### Create your migration\nYou will find a `2_deploy_contracts.js` file in the `migrations` folder. You will need to edit the first line of this file to add the name of your contract:\n\n    const Contract = artifacts.require(\"MyAwesomeContract\");\n\n### Optional: Install a *personal* blockchain\n\nA personal blockchain is the best tool to create and test smart contracts. We suggest you to install [Ganache](https://github.com/trufflesuite/ganache) or [Ganache CLI](https://github.com/trufflesuite/ganache-cli) (recommended)  on your computer.\n\nYou may need to edit the `truffle.js` file and change the following parameters in the `network: { development: { ...` part:\n\n - **Host:** the IP address where your personal blockchain is hosted (typically `127.0.0.1`)\n - **Port**: by default, Ganache is configured to run on port `7545`, but we decided to change it to `8545`, to use it with [MetaMask](https://metamask.io/)\n - **Gas / Gas price**: following your needs\n\n*Note: We encourage you to read [Ganache CLI](https://github.com/trufflesuite/ganache-cli) documentation, as useful options exist, such as the custom mnemonic or the persistant blockchain.*\n\n### Optional: Configure your linter\nAs said earlier, we included [Solhint](https://github.com/protofire/solhint) in this project. The best way to experience it is to use an [IDE integration](https://github.com/protofire/solhint).\nThen, you change the `.solhint.json` as you wish.\n\n*Note: We setup a custom rule in our config file to change indentation to 2 spaces instead of 4.*\n\n## Life of your project\nThis is a **quick** and **incomplete** guide about a Truffle project. If you want more information, you should take a look at the [Truffle documentation](https://truffleframework.com/docs).\n\n### Testing\nIf you already have a personal blockchain, tests can be run simply with `truffle test` or `npm test`. Additionally, you can run a specific file `truffle test ./test/my.test.js`.\n\n*Note: Tests can be written using [Javascript](https://truffleframework.com/docs/getting_started/javascript-tests) or [Solidity](https://truffleframework.com/docs/getting_started/solidity-tests), and should be stored in the `test` folder.*\n\n### Compiling\nTo compile your project, simply use `truffle compile`. Additionally, you are able to change the Solidity compiler options, as mentioned [here](https://truffleframework.com/docs/advanced/configuration#networks). We already turn the optimization option on.\n\n### Deploying\nFirst of all, make sure that you have specified your Infura API key in the `.env` file. Then, you should change the **gas** and the **gasPrice** parameters in the `truffle.js` file.\n\nThe last thing to do is to deploy on the desired network with `truffle migrate --network development` or `truffle migrate --network live`.\n\n*Note: The name of the networks (and the networks themselves) can be changed in the `truffle.js` file. Also, to learn more about the configuration file, you can go [read this page](https://truffleframework.com/docs/advanced/configuration#networks).*\n\n## Further reading\n\n - [Truffle Framework documentation](https://truffleframework.com/docs)\n - [Open Zeppelin documentation](https://openzeppelin.org/api/docs/open-zeppelin.html)\n - [Solidity documentation](http://solidity.readthedocs.io/en/v0.4.24/)\n - [Infura documentation](https://infura.io/docs)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclemlak%2Fsolidity-project-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclemlak%2Fsolidity-project-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclemlak%2Fsolidity-project-template/lists"}