# hexpm **Repository Path**: mirrors_hexpm/hexpm ## Basic Information - **Project Name**: hexpm - **Description**: API server and website for Hex - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-01-05 - **Last Updated**: 2026-04-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Hexpm [![CI](https://github.com/hexpm/hexpm/workflows/CI/badge.svg)](https://github.com/hexpm/hexpm/actions?query=workflow%3ACI) API server and website for . ## Contributing To contribute to Hexpm you need to properly set up your development environment. Also see the client repository: [hex](https://github.com/hexpm/hex). The client uses `hexpm` for integration tests, so `hexpm` needs to support all versions the client supports. CI ensures that tests are run on all supported versions. ### Setup 1. Run `mix setup` to install dependencies, create and seed database etc 2. Run `mix test` 3. Run `iex -S mix phx.server` and visit [http://localhost:4000/](http://localhost:4000/) After this succeeds you should be good to go! See [`setup` alias in mix.exs](./mix.exs) and sections below for more information or when you run into issues. ### PostgreSQL Modules And Version PostgreSQL version should be >= 9.4, as Hexpm uses the `jsonb` type, that is available from PostgreSQL 9.4 onward. Hexpm requires the PostgreSQL modules [pg_trgm](http://www.postgresql.org/docs/9.4/static/pgtrgm.html) and [pgcrypto](http://www.postgresql.org/docs/9.4/static/pgcrypto.html) to be available. This is located in the "postgresql-contrib" package, however the package name can vary depending on your operating system. If the module is not installed the ecto migrations will fail. ### Database By default, Hexpm connects to a localhost PostgreSQL database `hexpm_dev` using the username `postgres` with the password `postgres`. Create the database and user 'postgres' if not already done: ```sh docker-compose up -d db ``` Now you are fine to create the `hexpm_dev` database and run the ecto migrations: ```shell mix do ecto.create, ecto.migrate ``` ### Sample Data Using the following command you can seed your local Hexpm instance with some sample data: ```shell mix run priv/repo/seeds.exs ``` ### Node Dependencies It's recommended to enable [Corepack](https://yarnpkg.com/corepack) for a better developer experience: ```shell corepack enable ``` For assets compilation we need to install Node dependencies: ```shell cd assets && yarn install ``` If you don't have yarn installed, `cd assets && npm install` will work too. ### Running Hexpm Once the database is set up you can start Hexpm: ```shell # with console iex -S mix phx.server # without console mix phx.server ``` Hexpm will be available at [http://localhost:4000/](http://localhost:4000/). ### Billing Integration Tests Integration tests exercise the full chain: hexpm -> hexpm_billing -> Stripe. They are excluded from regular `mix test` runs and require additional setup. #### Stripe Sandbox Setup 1. **Create a Stripe sandbox** (if you don't already have one): Go to the [Stripe Dashboard](https://dashboard.stripe.com), open the account picker, click "Switch to sandbox", then "Create sandbox". Give it a name (e.g. "hexpm-dev"). 2. **Install and authenticate the Stripe CLI:** ```shell brew install stripe/stripe-cli/stripe stripe login ``` This opens a browser where you select which sandbox to log into. The CLI generates restricted keys valid for 90 days, stored in `~/.config/stripe/config.toml`. 3. **Configure hexpm_billing with your sandbox keys:** Copy the API keys from your sandbox's [API keys page](https://dashboard.stripe.com/test/apikeys) and update `hexpm_billing/config/dev.exs`: - `stripe_secret_key` — your sandbox secret key (`sk_test_...`) - `stripe_publishable_key` — your sandbox publishable key (`pk_test_...`) 4. **Forward Stripe webhooks to hexpm_billing:** ```shell stripe listen --forward-to localhost:4001/webhooks/payments ``` The CLI will print a webhook signing secret (`whsec_...`). Update `stripe_signing_secret_key` in `hexpm_billing/config/dev.exs` with this value. The secret stays the same between CLI restarts. #### Prerequisites 1. **hexpm_billing running locally on port 4001:** ```shell # In the hexpm_billing repo mix deps.get mix ecto.setup MIX_ENV=dev mix phx.server ``` 2. **ChromeDriver installed** (for browser tests): ```shell brew install chromedriver ``` 3. **Stripe CLI forwarding webhooks** (see above): ```shell stripe listen --forward-to localhost:4001/webhooks/payments ``` #### Running ```shell # All integration tests mix test --only integration # Only browser/SCA tests mix test test/hexpm_web/integration/sca_test.exs --include integration ``` ## License Copyright 2015 Six Colors AB Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.