Ecency vision – Ecency Web client
Immutable, decentralized, uncensored, rewarding communities powered by Hive.
Fast, simple and clean source code with Reactjs + Typescript.
- Production version - master branch
- Alpha version - development branch
Feel free to test it out and submit improvements and pull requests.
node ^18.17.xpnpm(the repo is configured withpackageManager: [email protected])
$ git clone https://github.com/ecency/vision-next
$ cd vision-next
This repository is organised as a pnpm workspace with the web
application living in apps/web and shared packages located under packages/*. pnpm keeps a
single lockfile (pnpm-lock.yaml) at the workspace root and all commands should be run from this
directory unless noted otherwise.
pnpm installpnpm will create a workspace-wide virtual store and automatically link local packages between
apps/* and packages/*.
You can execute scripts that are defined in each workspace package. Some useful commands are:
| Task | Command | Notes |
|---|---|---|
| Install dependencies | pnpm install |
Installs all workspace packages. |
| Start development server | pnpm --filter @ecency/web dev |
Runs the Next.js dev server for the web app. |
| Build for production | pnpm --filter @ecency/web build |
Builds the web app only. |
| Start production server | pnpm --filter @ecency/web start |
Runs the built web app. |
| Lint all packages | pnpm lint |
Executes pnpm -r lint defined in the root package.json. |
| Test all packages | pnpm test |
Executes pnpm -r test defined in the root package.json. |
To run a script in every workspace package (for example, to build all libraries and apps), use the
recursive flag defined in the root scripts: pnpm build will run pnpm -r build across the
workspace.
Packages in packages/* can be published individually. Use pnpm's filtering to target a specific
package:
pnpm --filter <package-name> publish --access publicReplace <package-name> with the actual package name declared in that package's package.json.
Make sure the package is built before publishing (pnpm --filter <package-name> build).
$ cp .env.template .env- Update values with your ones
Use extended configuration instead below.USE_PRIVATE- if instance has private api address and auth (0 or 1 value)–HIVESIGNER_IDNEXT_PUBLIC_HS_CLIENT_ID– This is a special application Hive account. If unset, "ecency.app" is the account used.–HIVESIGNER_SECRETNEXT_PUBLIC_HS_CLIENT_SECRET– This is a secret your site shares with HIVE_SIGNER in order to communicate securely.. Amp pages has been deprecated and will be removed by Google. Amp pages aren't longer supporting in Ecency vision.REDIS_URL- support for caching amp pages
When setting up another service like Ecency with Vision software:
- You may leave
NEXT_PUBLIC_HS_CLIENT_IDandNEXT_PUBLIC_HS_CLIENT_SECRETenvironment variables unset and optionally setUSE_PRIVATE=1and leaveNEXT_PUBLIC_APP_BASEset tohttps://ecency.com. Your new site will contain more features as it will use Ecency's private API. This is by far the easiest option. - You may change
NEXT_PUBLIC_APP_BASEto the URL of your own site, but you will have to set environment variablesNEXT_PUBLIC_HS_CLIENT_IDandNEXT_PUBLIC_HS_CLIENT_SECRET; setUSE_PRIVATE=0as well as configure your theHIVESIGNER_IDaccount at the Hivesigner website.. Hivesigner will need asecret, in the form of a long lowercase hexadecimal number. The HIVESIGNER_SECRET should be set to this value.
In order to validate a login, and do posting level operations, this software relies on Hivesigner. A user @alice will use login credentials to login to the site via one of several methods, but the site will communicate with Hivesigner and ask it to do all posting operations on behalf of @alice. Hivesigner can and will do this because both @alice will have given posting authority to the NEXT_PUBLIC_HS_CLIENT_ID user and the NEXT_PUBLIC_HS_CLIENT_ID user will have given its posting authority to Hivesigner.
Default branding values can now be customized via environment variables without editing source files. Override any of the following in your .env file:
NEXT_PUBLIC_APP_BASE
NEXT_PUBLIC_APP_NAME
NEXT_PUBLIC_APP_TITLE
NEXT_PUBLIC_APP_DESCRIPTION
NEXT_PUBLIC_TWITTER_HANDLE
NEXT_PUBLIC_APP_LOGO
NEXT_PUBLIC_IMAGE_SERVER
NEXT_PUBLIC_NWS_SERVER
If you are setting up your own website other than Ecency.com, set these variables to match your brand. There are also a lot of static pages that are Ecency specific.
Ecency vision has extended configuration based on feature-flag on/off specifications built in json format.
// Any ecency vision configuration file should be started with specific tag as below
{
"visionConfig": {
"features": {
...
}
}
}Feature flags and their formats: 1.
See src/config/vision-config.template.yml.
You can use official ecency/vision-next:latest image to run Vision locally, deploy it to staging or even production environment. The simplest way is to run it with following command:
docker run -it --rm -p 3000:3000 ecency/vision-next:latestConfigure the instance using following environment variables:
See extended configuration above.USE_PRIVATE
docker run -it --rm -p 3000:3000 -e USE_PRIVATE=1 ecency/vision-next:latestYou can easily deploy a set of vision instances to your production environment, using example docker-compose.yml file. Docker Swarm will automatically keep it alive and load balance incoming traffic between the containers:
docker stack deploy -c docker-compose.yml -c docker-compose.production.yml vision- Make sure to branch off your changes from
developmentbranch. - Make sure to run
pnpm testand add tests to your changes. - Make sure new text, strings are added into
en-US.jsonfile only. - Code on!
- Make PRs more clear with description, screenshots or videos, linking to issues, if no issue exist create one that describes PR and mention in PR. Reviewers may or may not run code, but PR should be reviewable even without running, visials helps there.
- PR should have title WIP, if it is not ready yet. Once ready, run
pnpm testand update all tests, make sure linting (pnpm lint) also done before requesting for review. - Creating component?! Make sure to create simple tests, you can check other components for examples.
- Always make sure component and pages stay fast without unnecessary re-renders because those will slow down app/performance.
To report a non-critical issue, please file an issue on this GitHub project.
If you find a security issue please report details to: [email protected]
We will evaluate the risk and make a patch available before filing the issue.
