Files
speckle-server/readme.md
T
2020-08-29 10:07:53 +01:00

99 lines
5.2 KiB
Markdown

# Server
[![Twitter Follow](https://img.shields.io/twitter/follow/SpeckleSystems?style=social)](https://twitter.com/SpeckleSystems) [![Discourse users](https://img.shields.io/discourse/users?server=https%3A%2F%2Fdiscourse.speckle.works&style=flat-square)](https://discourse.speckle.works)
[![Slack Invite](https://img.shields.io/badge/-slack-grey?style=flat-square&logo=slack)](https://speckle-works.slack.com/join/shared_invite/enQtNjY5Mzk2NTYxNTA4LTU4MWI5ZjdhMjFmMTIxZDIzOTAzMzRmMTZhY2QxMmM1ZjVmNzJmZGMzMDVlZmJjYWQxYWU0MWJkYmY3N2JjNGI) [![website](https://img.shields.io/badge/www-speckle.systems-royalblue?style=flat-square)](https://speckle.systems)
#### Status
[![Speckle-Next](https://circleci.com/gh/specklesystems/Server.svg?style=svg&circle-token=76eabd350ea243575cbb258b746ed3f471f7ac29)](https://github.com/Speckle-Next/SpeckleServer/) [![codecov](https://codecov.io/gh/Speckle-Next/SpeckleServer/branch/master/graph/badge.svg?token=PHZWVNUVFE)](https://codecov.io/gh/Speckle-Next/SpeckleServer)
## Disclaimer
This is an early alpha release, not meant for use in production! We're working to stabilise the 2.0 API, and until then there will be breaking changes. You have been warned!
## Introduction
This is the Speckle Server 2.0. It consists of two distinct parts:
- The server application itself, which is a nodejs app exposing a GraphQL API,
- The frontend application, which is a static vuejs app.
For example usage, do check out the tests! We'll be also adding preliminary documentation [on our forum](https://discourse.speckle.works/c/speckle-insider/10).
## Developing and Debugging
To get started, first clone this repo.
### Setup
#### Server
To run the **Server** in debug mode:
- Duplicate and rename `.env-example` to `.env` & fill it in!
- Make sure a postgres instance is running locally, with two databases present, named `speckle2_dev` and `speckle2_test`.
- Make sure a redis instance is running locally.
- Run `npm install`
- Run `npm run dev:server` 🚀
#### Frontend
To run the **Frontend** locally in debug mode:
- Switch your working directory to `/frontend`
- Run `npm install`
- Run `npm run dev:frontend` from the Server root folder, or `npm run serve` from `/frontend`.
To build the frontend, simply run `npm run build:frontend`.
> Tips:
>
> Postgres: For getting postgres, check out [postgres.app](https://postgresapp.com/), and the classic [pgadmin](https://www.pgadmin.org/download/pgadmin-4-macos/).
>
> Redis: you can use the [redis.app](https://jpadilla.github.io/redisapp/).
#### Windows
Some extra tips if you come across issues on Windows:
Redis isn't officially supported for Windows, but you can get a slightly out of date version [here](https://github.com/microsoftarchive/redis/releases/tag/win-3.0.504) which should work just fine.
For postgres, [pgAdmin](https://www.pgadmin.org/download/pgadmin-4-windows/) and [Postbird](https://github.com/Paxa/postbird/releases) are both good options for a GUI.
If starting up postgres isn't working, check your environment variables to make sure `C:\Program Files\PostgreSQL\<version>\bin` has been added to your system Path. You can also add variables `PGUSER` and `PGPASSWORD` here so you can skip logging in each time.
Make sure you're on node version 12 as newer versions of node may have problems connecting to the db.
### Testing
The Server is quite thoroughly covered by tests. Once you have followed the setup steps above, you can run all the tests by hitting `npm run test:server`.
For testing specific functionality, check out the npm scripts in `package.json` - they are breaking down the tests piecemeal. When working on the Server, we've always found useful to run in watch mode only the tests pertaining to what we were working on (e.g., `npm run test:server:objects`).
## Contributing
Please make sure you read the [contribution guidelines](CONTRIBUTING.md) for an overview of the best practices we try to follow.
When pushing commits to this repo, please follow the following guidelines:
- Install [commitizen](https://www.npmjs.com/package/commitizen#commitizen-for-contributors) globally (`npm i -g commitizen`).
- When ready to commit, type in the commandline `git cz` & follow the prompts.
- Install eslint globally `npm i -g eslint`
- VS code: install the `eslint` extension
- VS code: we also recommend setting it to run on save by adding the following VS Code setting
```
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
```
## Community
The Speckle Community hangs out in two main places, usually:
- on [the forum](https://discourse.speckle.works)
- on [the chat](https://speckle-works.slack.com/join/shared_invite/enQtNjY5Mzk2NTYxNTA4LTU4MWI5ZjdhMjFmMTIxZDIzOTAzMzRmMTZhY2QxMmM1ZjVmNzJmZGMzMDVlZmJjYWQxYWU0MWJkYmY3N2JjNGI)
Do join and introduce yourself!
## License
Unless otherwise described, the code in this repository is licensed under the Apache-2.0 License. Please note that some modules, extensions or code herein might be otherwise licensed. This is indicated either in the root of the containing folder under a different license file, or in the respective file's header. If you have any questions, don't hesitate to get in touch with us via [email](mailto:hello@speckle.systems).