Commit 01319056 authored by Lee Brown's avatar Lee Brown

Merge branch 'master' of gitlab.com:geeks-accelerator/oss/saas-starter-kit

parents b9fa73ae 0d42039a
......@@ -63,10 +63,21 @@ It contains the following features:
### Example project
With SaaS, a client subscribes to an online service you provide them. The example project provides functionality for
clients to subscribe and then once subscribed they can interact with your software service. For this example, *projects*
clients to subscribe and then once subscribed they can interact with your software service.
The initial contributors to this project are building this saas-starter-kit based on their years of experience building
building enterprise B2B SaaS. Particularily, this saas-starter-kit is based on their most recent experience building the
B2B SaaS for [standard operating procedure software](https://keeni.space) (100% Golang). Reference the Keeni.Space website,
its [SOP software pricing](https://keeni.space/pricing) and its signup process. The SaaS web app is then available at
[app.keeni.space](https://app.keeni.space). They plan on leveraging this experience and build it into a simplified set
example services for both a web API and a web app for SaaS businesses.
For this example, *projects*
will be the single business logic package that will be exposed to users for management based on their role. Additional
business logic packages can be added to support your project. It’s important at the beginning to minimize the connection
between business logic packages on the same horizontal level.
This project provides the following functionality to users:
New clients can sign up which creates an account and a user with role of admin.
......@@ -286,6 +297,9 @@ the API key for you Datadog account by setting the environmental variable: DD_AP
REST API available to clients for supporting deeper integrations. This API is also a foundation for third-party
integrations. The API implements JWT authentication that renders results as JSON to clients.
Once the web-app service is running it will be available on port 3001.
http://127.0.0.1:3001/
This web-api service is not directly used by the web-app service to prevent locking the functionally required for
internally development of the web-app service to the same functionality exposed to clients via this web-api service.
This separate web-api service can be exposed to clients and be maintained in a more rigid/structured process to manage
......@@ -297,19 +311,6 @@ the additional effort as the internal API can handle more flexible updates.
For more details on this service, read [web-api readme](https://gitlab.com/geeks-accelerator/oss/saas-starter-kit/blob/master/cmd/web-api/README.md)
### Making Requests to Web API
Once the web-api service is running it will be available on port 3000.
http://127.0.0.1:3001/
The easiest way to make requests to the web-api service is by using CURL via your CLI.
To make a request to the web-api service you must have an authenticated user. Users can be created with the API but an
initial admin user must first be created. The initial admin user can easily be created using the Swagger API documentation.
### API Documentation
Documentation for this API service is automatically generated using [swag](https://github.com/swaggo/swag). Once this
......@@ -318,84 +319,6 @@ web-api service is running, it can be accessed at /docs
http://127.0.0.1:3001/docs/
#### Initalize the database.
The database is created but does not include any schema when first started.
```bash
cd tools/schema/
source sample.env
go run main.go
```
#### Creating Initial User
Create an initial user service first using the signup endpoint documented at /docs
Find the endpoint for signup:
```
POST ​/signup Signup handles new account creation.
```
Click the button to Try it Out. Then adjust the values for the account and user objects accordingly.
```json
{
"account": {
"address1": "5445 Coolr Way",
"address2": "Box #1935",
"city": "Valdez",
"country": "USA",
"name": "Geeks on a Lake",
"region": "AK",
"timezone": "America/Anchorage",
"zipcode": "99686"
},
"user": {
"email": "[email protected]",
"name": "Gabi May",
"password": "SecretString",
"password_confirm": "SecretString"
}
}
```
Then click button Execute, which will return the CURL command and execute the call.
Example CURL command:
```bash
curl -X POST "http://127.0.0.1:3001/v1/signup" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"account\": { \"address1\": \"221 Tatitlek Ave\", \"address2\": \"Box #1832\", \"city\": \"Valdez\", \"country\": \"USA\", \"name\": \"Geeks on a Lake\", \"region\": \"AK\", \"timezone\": \"America/Anchorage\", \"zipcode\": \"99686\" }, \"user\": { \"email\": \"[email protected]\", \"name\": \"Gabi May\", \"password\": \"SecretString\", \"password_confirm\": \"SecretString\" }}"
```
If successful, data should be returned for code 201.
You will now be able to use the email and password credentials to generate an auth token with the web-api service.
#### Authenticating
Before any authenticated requests can be sent you must acquire an auth token. Make a request using HTTP Basic auth with
your email and password to get an auth token.
```bash
curl --user "[email protected]:SecretString" -X POST http://127.0.0.1:3001/v1/oauth/token
```
It is best to put the resulting token in an environment variable like `$TOKEN`.
#### Adding Token as Environment Variable
```bash
export TOKEN="COPY TOKEN STRING FROM LAST CALL"
```
#### Authenticated Requests
To make authenticated requests put the token in the `Authorization` header with the `Bearer ` prefix.
```bash
curl -H "Authorization: Bearer ${TOKEN}" http://127.0.0.1:3001/v1/users
```
## Web App
[cmd/web-app](https://gitlab.com/geeks-accelerator/oss/saas-starter-kit/tree/master/cmd/web-app)
......@@ -404,7 +327,7 @@ direct interaction with clients and their users. It allows clients to sign up ne
authentication with HTTP sessions. The web app relies on the Golang business logic packages developed to provide an API
for internal requests.
Once the web-app service is running it will be available on port 80.
Once the web-app service is running it will be available on port 3000.
http://127.0.0.1:3000/
While the web-api service is rocking, this web-app service is still in development. Only the signup functionality works
......@@ -414,47 +337,6 @@ If you would like to help, please email [email protected]
For more details on this service, read [web-app readme](https://gitlab.com/geeks-accelerator/oss/saas-starter-kit/blob/master/cmd/web-app/README.md)
### Functionality of Web App
The example web-app service is going to allow users to manage checklists. Users with role of admin will be allowed to
create new checklists (projects). Each checklist will have tasks (items) associated with it. Tasks can be assigned to
users with access to the checklist. Users can then update the status of a task.
We are referring to "checklists" as "projects" and "tasks" as "items" so this example web-app service will be generic
enough for you to leverage and build upon without lots of renaming.
This web-app service eventually will include the following functionality and corresponding web pages:
- authentication
- signup (creates user and account records)
- login
- with role-based access
- logout
- forgot password
- user management
- update user and password
- account management
- update account
- manage user
- view user
- create and invite user
- update user
- projects (checklists)
- index of projects
- browse, filter, search
- manage projects
- view project
- with project items
- create project
- update project
- user access
- project items (tasks)
- view item
- create item (adds task to checklist)
- update item
## Schema
[cmd/schema](https://gitlab.com/geeks-accelerator/oss/saas-starter-kit/tree/master/cmd/schema)
......
This diff is collapsed.
# SaaS Web App
Copyright 2019, Geeks Accelerator
[email protected].com
[email protected]
## Description
Provides an http service.
Responsive web application that renders HTML using the `html/template` package from the standard library to enable
direct interaction with clients and their users. It allows clients to sign up new accounts and provides user
authentication with HTTP sessions. The web app relies on the Golang business logic packages developed to provide an API
for internal requests.
Once the web-app service is running it will be available on port 3000.
http://127.0.0.1:3000/
While the web-api service has
significant functionality, this web-app service is still in development. Currently this web-app services only resizes
an image and displays resvised versions of it on the index page. See section below on Future Functionality.
If you would like to help, please email [email protected]
### Future Functionality
This example Web App is going to allow users to manage checklists. Users with role of admin will be allowed to
create new checklists (projects). Each checklist will have tasks (items) associated with it. Tasks can be assigned to
users with access to the checklist. Users can then update the status of a task.
We are referring to "checklists" as "projects" and "tasks" as "items" so this example web-app service will be generic
enough for you to leverage and build upon without lots of renaming.
The initial contributors to this project created a similar service like this: [standard operating procedure software](https://keeni.space/procedures/software)
for Keeni.Space. Its' Golang web app for [standard operating procedures software](https://keeni.space/procedures/software) is available at [app.keeni.space](https://app.keeni.space) They plan on leveraging this experience and boil it down into a simplified set of functionality
and corresponding web pages that will be a solid examples for building enterprise SaaS web apps with Golang.
This web-app service eventually will include the following:
- authentication
- signup (creates user and account records)
- login
- with role-based access
- logout
- forgot password
- user management
- update user and password
- account management
- update account
- manage user
- view user
- create and invite user
- update user
- projects (checklists)
- index of projects
- browse, filter, search
- manage projects
- view project
- with project items
- create project
- update project
- user access
- project items (tasks)
- view item
- create item (adds task to checklist)
- update item
## Local Installation
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment