|
4 | 4 |
|
5 | 5 | - [Overview](#overview)
|
6 | 6 | - [Prerequisites](#prerequisites)
|
| 7 | +- [Installation](#installation) |
7 | 8 | - [Getting Started](#getting-started)
|
8 |
| - - [Examples](#examples) |
9 |
| - - [Create a React Database App](#create-a-react-database-app) |
10 |
| - - [Create a Todo Database App](#create-a-todo-database-app) |
| 9 | +- [Templates](#templates) |
| 10 | +- [Options](#options) |
| 11 | +- [Examples](#examples) |
| 12 | + - [Usage](#usage) |
| 13 | + - [Simple React app](#simple-react-app) |
| 14 | + - [React todo app](#react-todo-app) |
| 15 | + - [Application without interactive prompts](#application-without-interactive-prompts) |
11 | 16 | - [Contributing](#contributing)
|
12 | 17 | - [Security](#security)
|
13 | 18 | - [License](#license)
|
14 | 19 |
|
15 | 20 | ## Overview
|
16 |
| -<!-- toc --> |
17 |
| -* [Database Create App](#database-create-app) |
18 |
| -<!-- tocstop --> |
19 | 21 |
|
20 |
| -<!-- installation --> |
21 |
| -## Installation |
22 |
| - |
23 |
| -1. Install the package globally using npm |
24 |
| - |
25 |
| -```properties |
26 |
| -npm install -g @dbtools/create-database-app |
27 |
| -``` |
28 |
| - |
29 |
| -## Project Name: |
30 |
| - |
31 |
| -2. Enter a desired name for your application |
32 |
| - |
33 |
| -```properties |
34 |
| -? What would you like your application's name to be? |
35 |
| -``` |
36 |
| -
|
37 |
| -## Template Selection: |
38 |
| -
|
39 |
| -1. Select node-vanilla |
40 |
| -
|
41 |
| -```properties |
42 |
| -? Which template would you like to use for your project? (Use arrow keys) |
43 |
| -> node-vanilla |
44 |
| -> node-react |
45 |
| -> node-vue |
46 |
| -> node-react-todo |
47 |
| -``` |
48 |
| -## Database Connection Type: |
49 |
| -
|
50 |
| -1. Select the preferred database connection method |
51 |
| -
|
52 |
| -```properties |
53 |
| -? Which database connection type would you like to choose? (Use arrow keys) |
54 |
| -> Cloud Wallet Path |
55 |
| -> Basic Connection (Protocol, Hostname, Port, Service Name / SID) |
56 |
| -``` |
| 22 | +Create an Oracle Database Application from a template. |
57 | 23 |
|
58 |
| -## Basic Connection Configuration: |
| 24 | +NOTE: The applications generated by this package should not be deployed using privileged database accounts. In turn, Oracle recommends for them to be deployed using the least privileged account possible. |
59 | 25 |
|
60 |
| -1. Provide database connection details when promted by the terminal |
| 26 | +## Prerequisites |
61 | 27 |
|
62 |
| -- Protocol: (defaults to TCP) |
63 |
| -```properties |
64 |
| -? What is your database protocol? (TCP) |
65 |
| -``` |
| 28 | +- An Oracle Database, either on-prem or an [Autonomous Database](https://www.oracle.com/autonomous-database/) instance |
| 29 | +- Node.js 18 (Recommendation is to use nvm) |
66 | 30 |
|
67 |
| -- Hostname: (defaults to localhost) |
68 |
| -```properties |
69 |
| -? What is your database protocol? (TCP) |
70 |
| -``` |
| 31 | +## Installation |
71 | 32 |
|
72 |
| -- Protocol: (defaults to TCP) |
73 |
| -```properties |
74 |
| -? What is your database port? (1521) |
75 |
| -``` |
| 33 | +Install the package globally using npm |
76 | 34 |
|
77 |
| -- Service Type: |
78 |
| -```properties |
79 |
| -? Which service type would you like to use? (Use arrow keys) |
80 |
| -> SID |
81 |
| -> Service name |
| 35 | +```sh |
| 36 | +npm install -g @oracle/create-database-app |
82 | 37 | ```
|
83 | 38 |
|
84 |
| -- SID: |
85 |
| -```properties |
86 |
| -? Please input your database SID: |
87 |
| -``` |
| 39 | +## Getting Started |
88 | 40 |
|
89 |
| -- Service Name: |
90 |
| -```properties |
91 |
| -? Please input your database service name: |
92 |
| -``` |
| 41 | +The main application usage is through the @oracle/create-database-app NPM package, which will scaffold an application that will be connected to your Oracle Database. |
93 | 42 |
|
94 |
| -- Database Username |
95 |
| -```properties |
96 |
| -? What's your database username? |
| 43 | +```sh |
| 44 | +npm create @oracle/database-app |
97 | 45 | ```
|
| 46 | +This will temporarily install the package in your computer and prompt you for details like the name of the application, the template, and the database connection, from which it will create a git folder named as the given application name in your current directory, and install its dependencies. |
98 | 47 |
|
99 |
| -- Database Password |
100 |
| -```properties |
101 |
| -? What's your database password? |
102 |
| -``` |
| 48 | +Next, you will be able to open the project in your favorite IDE or Code Editor and read the provided documentation to get started creating a database application using your favorite framework. We ship configuration files with recommended settings and extensions for Visual Studio Code. |
103 | 49 |
|
104 |
| -# Database Environment |
105 |
| -Within this .env file, you'll find details regarding the connection to the database used in the application. |
| 50 | +## Templates |
106 | 51 |
|
107 |
| -```properties |
108 |
| -# Database User |
109 |
| -DB_USER= username |
110 |
| -# Database User |
111 |
| -DB_PASSWORD= password |
112 |
| -# Connection string to your ADB instance |
113 |
| -CONNECT_STRING= connection_string |
114 |
| -``` |
| 52 | +The package offers the following templates, which connect to the database using the [oracledb database driver](https://github.com/oracle/node-oracledb): |
115 | 53 |
|
116 |
| -# Cloud Wallet Path (if selected) |
117 |
| -If you selected the option of Cloud Wallet path yo will need |
118 |
| -to establish an Oracle Wallet, you'll require the Oracle Public Key Infrastructure (PKI) command line tool, known as orapki. |
| 54 | +- `node-vanilla`: A starter template that uses Node.js, vanilla JavaScript, HTML and CSS. It is built by [vite](https://vitejs.dev/). |
| 55 | +- `node-jet`: A starter template that uses Node.js and [Oracle JET](https://www.oracle.com/webfolder/technetwork/jet/index.html). It is built using the [ojet-cli](https://www.npmjs.com/package/@oracle/ojet-cli). |
| 56 | +- `node-react`: A starter template that uses Node.js and [React](https://react.dev/). It is built by [vite](https://vitejs.dev/). |
| 57 | +- `node-vue`: A starter template that uses Node.js and [Vue.js](https://vuejs.org/). It is built by [vite](https://vitejs.dev/). |
| 58 | +- `node-angular`: A starter template that uses Node.js and [Angular](https://angular.dev/). It is built by [Angular CLI](https://github.com/angular/angular-cli). (New in `v1.2.0`) |
| 59 | +- `node-react-todo`: A simple task manager template that uses Node.js and [React](https://react.dev/). It demonstrates the use of the database for Create, Read, Update and Delete (CRUD) operations. It is built by [vite](https://vitejs.dev/). |
119 | 60 |
|
120 |
| -```properties |
121 |
| -WALLETPATH <Domain Root>/<Domain Name>/config/fmwconfig/essconfig/essbase/walletssl |
122 |
| -``` |
| 61 | +Each of the templates include documentation for you to get started with them, as well as NPM scripts for you to use right after generating the application. |
123 | 62 |
|
124 |
| -Next you will then provide the path of your Cloud Wallet |
125 |
| -```properties |
126 |
| -? Please input your Cloud Wallet Path: |
127 |
| -``` |
| 63 | +## Options |
128 | 64 |
|
129 |
| -# Cloud Wallet Environment |
130 |
| -Within this configuration file, you'll find details regarding the connection to the cloud Wallet used in the application. |
| 65 | +You can provide the following options directly to the command: |
131 | 66 |
|
132 |
| -```properties |
133 |
| -# Oracle Wallet Password (If using a cloud wallet) |
134 |
| -WALLET_PASSWORD= password |
135 |
| -# Path to your Oracle Wallet directory (If using a cloud wallet) |
136 |
| -WALLET_LOCATION= <Domain Root>/<Domain Name>/config/fmwconfig/essconfig/essbase/walletssl |
137 |
| -``` |
138 |
| -<!-- installationstop --> |
139 |
| - |
140 |
| -## Usage |
141 |
| -<!-- usage --> |
142 |
| -```sh-session |
143 |
| -$ npm install -g @dbtools/create-database-app |
144 |
| -$ create-database-app COMMAND |
145 |
| -running command... |
146 |
| -$ create-database-app (--version) |
147 |
| -@dbtools/create-database-app/1.1.3 darwin-arm64 node-v18.18.2 |
148 |
| -$ create-database-app --help [COMMAND] |
149 |
| -USAGE |
150 |
| - $ create-database-app COMMAND |
| 67 | +- `template`: Name of the template to use ([See options above](#templates)) |
| 68 | +- `connection-type`: Options listed below: |
| 69 | + - `basic`: Requires additional information like `db-protocol`, `db-hostname`, etc. |
| 70 | + - `walletPath`: Requires a path to the wallet via the `wallet-path` flag. |
| 71 | +- `wallet-path`: Path to the zip file (or folder if uncompressed) containing the wallet and network configuration files. |
| 72 | +- `db-username`: Database username to connect. **Note**: For [Autonomous Databases](https://www.oracle.com/autonomous-database/) we do not recommend using the ADMIN user. |
| 73 | +- `db-protocol`: For details consult [Connecting to Oracle Database](https://node-oracledb.readthedocs.io/en/latest/user_guide/connection_handling.html). |
| 74 | +- `db-hostname`: For details consult [Connecting to Oracle Database](https://node-oracledb.readthedocs.io/en/latest/user_guide/connection_handling.html). |
| 75 | +- `db-port`: For details consult [Connecting to Oracle Database](https://node-oracledb.readthedocs.io/en/latest/user_guide/connection_handling.html). |
| 76 | +- `db-service-type`: Options listed below. For details consult [Connecting to Oracle Database](https://node-oracledb.readthedocs.io/en/latest/user_guide/connection_handling.html). |
| 77 | + - `serviceName` |
| 78 | + - `sid` |
| 79 | +- `db-service-name`: For details consult [Connecting to Oracle Database](https://node-oracledb.readthedocs.io/en/latest/user_guide/connection_handling.html). |
| 80 | +- `db-sid`: For details consult [Connecting to Oracle Database](https://node-oracledb.readthedocs.io/en/latest/user_guide/connection_handling.html). |
| 81 | + |
| 82 | +## Database Environment |
| 83 | +When an application is generated, you'll find a `.env` file with details regarding the connection to the database used in the application. |
| 84 | + |
| 85 | +```properties |
| 86 | +# Database user |
| 87 | +DB_USER=<my-username> |
| 88 | +# Database password |
| 89 | +DB_PASSWORD=<my-password> |
151 | 90 | ...
|
152 | 91 | ```
|
153 |
| -<!-- usagestop --> |
154 |
| -## Commands |
155 |
| - |
156 |
| -Create an Oracle Database Application from a template. |
157 |
| - |
158 |
| -NOTE: The applications generated by this package should not be deployed using |
159 |
| -privileged database accounts. In turn, Oracle recommends for them to be deployed |
160 |
| -using the least privileged account possible. |
161 | 92 |
|
162 |
| -## Prerequisites |
163 |
| - |
164 |
| -- An Oracle Database, either on-prem or an |
165 |
| - [Autonomous Database](https://www.oracle.com/autonomous-database/) instance |
166 |
| -- Node.js 18 (Recommendation is to use [nvm](https://github.com/nvm-sh/nvm)) |
167 |
| - |
168 |
| -## Getting Started |
| 93 | +## Examples |
169 | 94 |
|
170 |
| -The main application usage is through the `@oracle/create-database-app` NPM |
171 |
| -package, which will scaffold an application that will be connected to your |
172 |
| -Oracle Database. |
| 95 | +### Usage |
173 | 96 |
|
| 97 | +The simplest example on how to use the generator is via: |
174 | 98 | ```sh
|
175 | 99 | npm create @oracle/database-app
|
176 | 100 | ```
|
| 101 | +This opens an interactive prompt where information regarding the application and connection details can be provided. |
177 | 102 |
|
178 |
| -This will temporarily install the package in your computer and prompt |
179 |
| -you for details like the name of the application, the template, and the database |
180 |
| -connection, from which it will create a git folder named as the given |
181 |
| -application name in your current directory, and install its dependencies. |
182 |
| - |
183 |
| -Next, you will be able to open the project in your favorite IDE or Code Editor |
184 |
| -and read the provided documentation to get started creating a database |
185 |
| -application using your favorite framework. We ship configuration files with |
186 |
| -recommended settings and extensions for Visual Studio Code. |
187 |
| - |
188 |
| -The package offers the following templates, which connect to the database |
189 |
| -using the the [`oracledb` database driver](https://github.com/oracle/node-oracledb): |
190 |
| - |
191 |
| -- `node-vanilla`: A starter template that uses Node.js, vanilla JavaScript, HTML |
192 |
| - and CSS. It is built by [`vite`](https://vitejs.dev/) |
193 |
| -- `node-jet`: A starter template that uses Node.js and |
194 |
| - [Oracle JET](https://www.oracle.com/webfolder/technetwork/jet/index.html). |
195 |
| - It is built using the `ojet-cli` |
196 |
| -- `node-react`: A starter template that uses Node.js and |
197 |
| - [React](https://react.dev/). It is built by [`vite`](https://vitejs.dev/) |
198 |
| -- `node-vue`: A starter template that uses Node.js and |
199 |
| - [Vue.js](https://vuejs.org/). It is built by [`vite`](https://vitejs.dev/) |
200 |
| -- `node-react-todo`: A simple task manager template that uses Node.js and |
201 |
| - [React](https://react.dev/). It demonstrates the use of the database for |
202 |
| - Create, Read, Update and Delete (CRUD) operations. It is built by |
203 |
| - [`vite`](https://vitejs.dev/) |
204 |
| - |
205 |
| -Each of the templates include documentation for you to get started with them, as |
206 |
| -well as NPM scripts for you to use right after generating the application. |
| 103 | +### Simple React app |
207 | 104 |
|
208 |
| -You can provide the following options directly to the command: |
209 |
| - |
210 |
| -- `--name`: followed by the name of your application |
211 |
| -- `--template`: followed by the name of the template to use (See above) |
212 |
| - |
213 |
| -If none or only a few options are provided to the command, it will prompt for |
214 |
| -the missing details. |
215 |
| - |
216 |
| -### Examples |
| 105 | +```sh |
| 106 | +npm create @oracle/database-app -- "my-react-app" --template "node-react" |
| 107 | +``` |
217 | 108 |
|
218 |
| -#### Create a React Database App |
| 109 | +### React todo app |
219 | 110 |
|
220 |
| -If you want to generate an application named `my-app` with the `node-react` |
221 |
| -template, you can execute: |
| 111 | +You can generate an example of a fully functional application. The example below creates an app named `my-todo` with the `node-react-todo` template. |
222 | 112 |
|
223 | 113 | ```sh
|
224 |
| -npm create @oracle/database-app -- \ |
225 |
| - --name 'my-app' \ |
226 |
| - --template 'node-react' |
| 114 | +npm create @oracle/database-app -- "my-todo" --template "node-react-todo" |
227 | 115 | ```
|
228 | 116 |
|
229 |
| -#### Create a Todo Database App |
| 117 | +### Application without interactive prompts |
230 | 118 |
|
231 |
| -If you want to generate an application named `my-todo` with the `node-todo` |
232 |
| -template, you can execute: |
| 119 | +Any combination of parameters defined via the interactive prompt can be defined using a flag as part of the command.* |
233 | 120 |
|
234 | 121 | ```sh
|
235 |
| -npm create @oracle/database-app -- \ |
236 |
| - --name 'my-todo' \ |
237 |
| - --template 'node-react-todo' |
| 122 | +npm create @oracle/database-app -- "my-app" \ |
| 123 | + --template "node-react" \ |
| 124 | + --connection-type "walletPath" \ |
| 125 | + --db-username "<my-db-user>" \ |
| 126 | + --wallet-path "<path>.zip" |
238 | 127 | ```
|
239 | 128 |
|
| 129 | +The example above shows how to connect to an [Autonomous Database](https://www.oracle.com/autonomous-database/) using a wallet. |
| 130 | + |
| 131 | +Note: passwords still need to be provided using the prompt. |
| 132 | + |
240 | 133 | ## Contributing
|
241 | 134 |
|
242 | 135 | This project welcomes contributions from the community. Before submitting a pull
|
|
0 commit comments