Beranda

Terbaru

post
Kamis, 05 Sep 2024

Setup Terminal VPS

Biar tampilan terminal vps kita lebih menarik, gua mau setup terminal vps Ubuntu 24.04 gua menggunakan zsh, Oh My Zsh!, powerlevel10k dan zsh-autosugesstions. Gua juga mau install zoxide + fzf biar navigasi ke folder-folder lebih gampang. Install zsh & Oh My Zsh!zsh merupakan terminal biasa seperti bash, cmd, powershell, dll. Dengan menginstall Oh My Zsh!, kita dapat menggunakan plugin dan tema untuk terminal zsh kita. Langsung aja kita install zsh-nya terlebih dahulu sudo apt update -y && sudo apt upgrade -y sudo apt install zsh -y  Cek apakah zsh sudah terinstall atau belum zsh --version # expected >>> zsh 5.9 or similiar  Sekarang atur zsh sebagai terminal default chsh -s $(which zsh)  Coba kita logout dulu dan masuk lagi ke vps-nya untuk ngecek kalo zsh sudah jadi terminal default kita. Kalo berhasil, kita diminta untuk konfigurasi awal zsh kita.    Untuk saat ini kita ketik 0 aja untuk buat configuration filenya aja. nanti mungkin akan kita ubah ketika udah mulai install powerlevel10k. Kalo mau liat isi file konfigurasinya bisa jalankan nano ~/.zshrc. Selanjutnya kita install Oh My Zsh! dengan menjalankan sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"  kalo berhasil, hasilnya kaya gini:   Sampe sini, udah cukup bagus ya terminalnya, lebih berwarna dan simple. Biar lebih mantep, gua mau pasang tema powerlevel10k. Install powerlevel10kBtw, di laptop windows, gua menggunakan aplikasi terminal dari windows store dengan default profile-nya PowerShell   Pada menu Settings > Defaults > Appearance, gua menggunakan Color schema "One Half Dark" dan Font face MesloLGS NF sesuai dengan rekomendasi font dari powerlevel10k  Kalo udah setting terminalnya dengan font "MesloLGS NF", kita lanjut install powerlevel10k git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k  Buka konfigurasi zsh (nano ~/.zshrc), ganti ZSH_THEME menjadi: ZSH_THEME="powerlevel10k/powerlevel10k"  Notes: simpan dengan Ctrl+X, y, Enter. Selanjutnya kita restart zsh dengan exec zsh. Akan muncul prompt konfigurasi dari powerlevel10k seperti ini:  Notes: kalo gk muncul prompt-nya coba jalanin p10k configure Silahkan setting sesuai keinginan kalian, kalo gua kurang lebih kaya gini settingnya: y > y > y > y > 3 > 1 > 2 > 3 > 3 > 1 > 2 > 3 > 4 > 2 > 2 > 1 > n > 1 > y Kurang lebih hasilnya akan seperti ini:  Install zsh-autosuggestionsBiar terminalnya ada autosuggestions-kita install plugin zsh-autosuggestions git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions  Tambahin plugin-nya di file ~/.zshrc (nano ~/.zshrc) pada bagian plugins plugins=( # other plugins... git zsh-autosuggestions )  Restart zsh dengan exec zsh, kalo berhasil akan muncul suggestion berdasarkan histori command kita.  Install zoxide + fzfLast but no least, kita install zoxide agar memudahkan navigasi. Misal dari /home/user kita mau masuk ke folder aplikasi kita yaitu my-app yang ada di /app/project. Normalnya kita akan menjalankan: cd /app/project/my-app  Nah, kalo pake zoxide, asalkan udah pernah masuk ke direktori my-app sebelumnya, dari manapun kita cukup jalankan cd my-app. Ibaratnya zoxide ini kaya fitur search untuk nyari folder-folder yang udah pernah dikunjungi. Langsung aja install curl -sSfL https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | sh  kita install juga fzf untuk command-line fuzzy finder. sudo apt install fzf  Tambahkan script berikut di ~/.zshrc di line paling bawah # Export PATH for zoxide export PATH="$HOME/.local/bin:$PATH" # ============================================================================= # # Utility functions for zoxide. # # pwd based on the value of _ZO_RESOLVE_SYMLINKS. function __zoxide_pwd() { \command cygpath -w "$(\builtin pwd -P)" } # cd + custom logic based on the value of _ZO_ECHO. function __zoxide_cd() { # shellcheck disable=SC2164 \builtin cd -- "$@" } # ============================================================================= # # Hook configuration for zoxide. # # Hook to add new entries to the database. function __zoxide_hook() { # shellcheck disable=SC2312 \command zoxide add -- "$(__zoxide_pwd)" } # Initialize hook. # shellcheck disable=SC2154 if [[ ${precmd_functions[(Ie)__zoxide_hook]:-} -eq 0 ]] && [[ ${chpwd_functions[(Ie)__zoxide_hook]:-} -eq 0 ]]; then chpwd_functions+=(__zoxide_hook) fi # ============================================================================= # # When using zoxide with --no-cmd, alias these internal functions as desired. # __zoxide_z_prefix='z#' # Jump to a directory using only keywords. function __zoxide_z() { # shellcheck disable=SC2199 if [[ "$#" -eq 0 ]]; then __zoxide_cd ~ elif [[ "$#" -eq 1 ]] && { [[ -d "$1" ]] || [[ "$1" = '-' ]] || [[ "$1" =~ ^[-+][0-9]$ ]]; }; then __zoxide_cd "$1" elif [[ "$@[-1]" == "${__zoxide_z_prefix}"?* ]]; then # shellcheck disable=SC2124 \builtin local result="${@[-1]}" __zoxide_cd "${result:${#__zoxide_z_prefix}}" else \builtin local result # shellcheck disable=SC2312 result="$(\command zoxide query --exclude "$(__zoxide_pwd)" -- "$@")" && __zoxide_cd "${result}" fi } # Jump to a directory using interactive search. function __zoxide_zi() { \builtin local result result="$(\command zoxide query --interactive -- "$@")" && __zoxide_cd "${result}" } # Completions. if [[ -o zle ]]; then function __zoxide_z_complete() { # Only show completions when the cursor is at the end of the line. # shellcheck disable=SC2154 [[ "${#words[@]}" -eq "${CURRENT}" ]] || return 0 if [[ "${#words[@]}" -eq 2 ]]; then _files -/ elif [[ "${words[-1]}" == '' ]] && [[ "${words[-2]}" != "${__zoxide_z_prefix}"?* ]]; then \builtin local result # shellcheck disable=SC2086,SC2312 if result="$(\command zoxide query --exclude "$(__zoxide_pwd)" --interactive -- ${words[2,-1]})"; then result="${__zoxide_z_prefix}${result}" # shellcheck disable=SC2296 compadd -Q "${(q-)result}" fi \builtin printf '\e[5n' fi return 0 } \builtin bindkey '\e[0n' 'reset-prompt' [[ "${+functions[compdef]}" -ne 0 ]] && \compdef __zoxide_z_complete __zoxide_z fi # ============================================================================= # # Commands for zoxide. Disable these using --no-cmd. # \builtin alias cd=__zoxide_z \builtin alias cdi=__zoxide_zi # ============================================================================= # # To initialize zoxide, add this to your configuration (usually ~/.zshrc): # eval "$(zoxide init zsh)"  Apply konfigurasi dengan command source ~/.zshrc. Kemudian kita coba masuk ke direktori /etc/ssh dan balik lagi ke direktori user. cd /etc/ssh cd  Nah, kalo sudah cukup dengan command cd ssh, kita akan masuk ke direktori /etc/ssh  Terakhir, jalankan command cdi untuk melihat direktori yang telah disimpan zoxide. Arahkan kursor untuk memilih direktori yang dituju  PenutupAlright, cukup segini aja untuk setup terminal vps-nya. Bye 😎

post
Rabu, 29 Mei 2024

Setup VPS Ubuntu 24

Kali ini gua akan setup vps dengan OS Ubuntu 24.04. gua akan mulai setup vps dari pertama kali masuk ke vps melalui terminal powershell di laptop windows gua. Untuk setup basic-nya gua ngikutin setup-annya kang Dea Afrizal (bisa ditonton di YouTube).   Update dan upgrade aptSebelum kita setup vps, baiknya kita update dan upgrade apt kita untuk memastikan package-package yang ada terupdate. sudo apt update -y && sudo apt upgrade -y    Install neofetchBiar gaya, kita install neofetch untuk nampilin spesifikasi vps kita. sudo apt install neofetch -y neofetch    Add UserSaat pertama kali kita masuk ke vps, pasti kita akan menggunakan root user. Nah, karena root user ini bisa akses segala macem permission, gua akan bikin user baru agar nantiya gua bisa masuk ke vps tanpa pakai root user. Kita bisa bikin user baru dengan menggunakan root user dan menjalankan command: adduser {username} // ganti {username} dengan username kalian  Setelah itu akan muncul beberapa pertanyaan terkait pembuatan user dan kalian bisa isi sesuai kebutuhan.   Notes: ketika kita ketik passwordnya, emang gk keliatan di terminal jadi ketik aja yang sesuai dan pastiin pas retype passwordnya juga bener   Terus masih menggunakan root user, gua mau nambahin user yang udah dibikin ke group sudo biar user ini bisa install-install pake sudo usermod -aG sudo {username}  Kalo udah berhasil, coba masuk pake user yang baru dengan command su - {username}. Kalo berhasil nanti tampilannya kaya gini:   kita cek groups nya   Nah, skrg kita bisa pake sudo di user yang baru kaya gini:   Ketik command su - untuk balik login ke root user   Config SSHBy default, ketika kita masuk ke vps menggunakan ssh, maka kita akan masuk menggunakan port 22 dan kita juga bisa masuk menggunakan root user. Gua akan config ssh agar port yang digunakan sesuai keinginan gua dan untuk root user gak boleh masuk pakai ssh. Kita login dengan root user kemudian buka file /etc/ssh/sshd_config menggunakan nano: nano /etc/ssh/sshd_config  Cari bagian #Port 22 tambahin 1 baris dengan port yang kalian mau misalnya Port 1234.   Cari lagi di paling bawah ada bagian PermitRootLogin yes kita ganti jadi PermitRootLogin no   Save dengan tekan Ctrl+X, y, dan Enter.   Restart service ssh dengan command systemctl restart sshd. Notes: kalau muncul error sshd.service not found bisa lakukan command berikut: systemctl disable ssh.socket systemctl stop ssh.socket systemctl disable ssh.service systemctl enable ssh.service systemctl restart sshd  Kemudian pastiin portnya udah keganti kaya gini: sudo systemctl status sshd    Test hasil config SSHBuka terminal baru, harusnya kalian udah gabisa masuk vps kaya gini ssh {username}@{ip_vps} output >>> ssh: connect to host {ip_vps} port 22: Connection timed outNotes: kalo masih bisa connect coba reboot vpsnya   kita tambahin opsi -p 1234 biar bisa masuk menggunakan user selain root ssh {username}@{ip_vps} -p 1234  Terus kalo mau login pake root user bisa jalankan su - kaya gini   Setup Firewall with UncomplicatedFirewall (ufw)kalo pake ubuntu seharusnya udah ada package ufw. Untuk memastikannya jalankan ufw status dan harusnya masih inactive. Sebelum mengaktifkan ufw kita harus allow port ssh yang kita udah config sebelumnya, kalo nggak kita gabisa masuk lagi ke vpsnya (kejadian di gue soalnya wkwk 🤣). jalankan ufw allow 1234/tcp untuk allow port ssh yang sesuai dengan config-nya. Kemudian enable ufw ufw enable dan cek statusnya ufw status   Jangan logout dulu dari session root, Coba pastiin kita bisa masuk ke vps di terminal baru.   Setup NginxSampai sekarang ketika kita akses ip public vps-nya melalui browser harusnya belum ada konten apa-apa (loading lama dan connection timeout). Sekarang kita coba install nginx untuk menampilkan html sederhana dari vps kita. Jalankan command berikut: sudo apt install nginx -y  Karena kita udah setup ufw sebelumnya, kita belom bisa akses ip public melalui browser dengan protcol http/https. jalankan command ufw allow http && ufw allow https (pake sudo kalo bukan root user) kemudian coba akses ip public melalui browser. Seharusnya akan keluar halaman Welcome to nginx!.   kalo nggak keluar coba reload ufw nya dengan command ufw reload dan cek list port yang di-allow dengan ufw status. Pastikan sudah ada port 80 (http) dan 443 (https).   Kalo mau ganti isi html-nya bisa edit file nya dengan command nano /var/www/html/index.nginx-debian.html atau hapus file itu dan bikin file index.html di direktori /var/www/html.   PenutupAlright! cukup segini dulu gess setup vps-nya. After ini gua mau coba setup terminal menggunakan ohmyzsh, powerlevel10k, zsh-autosuggestions, fzf , dan zoxide. Setelah itu baru kita belajar deploy-deploy aplikasi yang kita udah develop. Bye 😎

post
Selasa, 07 Mei 2024

Design Pattern Fullstack NextJS with App Router

Halo semua, kali ini gua mau sharing untuk setup Fullstack NextJS sesuai dengan Design Pattern yang gua akan sering pake di project Fullstack NextJS. Buat yang belum tau, Design Pattern menurut pemahaman gua adalah suatu aturan standar atau pola yang ditentukan di awal pengerjaan aplikasi mengenai penulisan kode program. Aturan standar tersebut meliputi penentuan struktur folder, gaya penulisan kode, aturan penggunaa git, dan lain-lain yang menunjang proses penulisan kode.   Tujuan dibuatnya Design Pattern ini adalah untuk memudahkan developer terutama yang berkerja dalam tim untuk menghasilkan kode yang bagus, yakni: * kode yang mudah dimengerti banyak developer bahkan yang di luar tim,  * kode yang mudah dilanjutkan proses pengembangannya dalam waktu jangka panjang, * dan yang cukup penting adalah kode yang mudah untuk di-fixing ketika ada bug karena cukup mudah mencari letak masalahnya. Selain itu ketika kita bekerja dalam tim, dengan adanya Design Pattern developer-developer akan cukup jelas bagaimana mereka harus menulis kode, bagian file-file mana saja yang menjadi tugasnya, dan bisa menghindari terhapusnya kode-kode developer lain secara tidak sengaja akibat penggunaan git yang kurang tepat.   Khusus di blog ini gua hanya membahas mengenai setup NextJS dengan konfigurasi TypeScript, ESLint, Prettier, husky + lintstage dan struktur folder yang gua terapkan.   Prerequisite * Install NodeJS minimum Versi 18.20.2 * Sudah pernah belajar React * Familiar dengan TypeScript * Terminal (git bash, cmd, powershell, dll) * Text Editor Visual Stuido Code   Setup NextJSInstall NextJSLangkah pertama gua akan menginstall NextJS melalui terminal dengan command berikut: npx create-next-app@14.2.3  Kemudian kalian bisa mengisi pertanyaan-pertanyaannya kaya gambar berikut atau sesuai dengan kebutuhan project kalian:     kalo udah berhasil terinstall kalian bisa masuk ke direktori project-nya, kemudian buka dengan Visual Studio Code cd ./fullstack-next code .  Selanjutnya kita install beberapa dependecies berikut dengan cara kalian copy file package.json berikut, kemudian paste ke package.json kalian yang ada di root project: fullstack-next |--... |--package.json |--...  { "name": "fullstack-next", "version": "0.1.0", "private": true, "scripts": { "dev": "next dev", "build": "next build", "start": "next start", "lint": "next lint" }, "dependencies": { "@prisma/client": "^5.13.0", "next": "14.2.3", "react": "^18", "react-dom": "^18", "winston": "^3.13.0" }, "devDependencies": { "@types/node": "^20", "@types/react": "^18", "@types/react-dom": "^18", "eslint": "^8", "eslint-config-next": "14.2.3", "eslint-config-prettier": "^9.1.0", "eslint-import-resolver-typescript": "^3.6.1", "eslint-plugin-import": "^2.29.1", "eslint-plugin-prettier": "^5.1.3", "husky": "^9.0.11", "lint-staged": "^15.2.2", "postcss": "^8", "prettier": "^3.2.5", "prettier-eslint": "^16.3.0", "prettier-plugin-tailwindcss": "^0.5.14", "prisma": "^5.13.0", "tailwindcss": "^3.4.1", "typescript": "^5" } }   Setup Prettier dan ESLintOke, pertama kita konfigurasi Prettier dan ESLint. Prettier ini berfungsi untuk memformat kode kita secara otomatis agar sesuai dengan konfigurasi yang kita tentukan seperti berapa jumlah spasi untuk indentasi tab, jumlah karakter perbaris, dan lain sebagainya. Sedangkan ESLint berfungsi sebagai Static Code Analysis untuk mengidentifikasi pola kode yang bermasalah pada kodingan JavaScript/TypeScript yang tidak sesuai dengan standar yang kita konfigurasi.    Buat file .prettierrc di root project dengan data JSON berikut: { "trailingComma": "all", "tabWidth": 2, "semi": true, "endOfLine": "auto", "printWidth": 80, "plugins": ["prettier-plugin-tailwindcss"] }   * trailingComma untuk menambahkan koma di akhir elemen object, array, dan argumen function. * tabWidth untuk menentukan jumlah spasi pada indentasi. * semi untuk menambahkan titik koma (;) di akhir kode. * endOfLine untuk menentukan akhir suatu baris (LF, CRLF, CR, Auto). * printWidth untuk menentukan maksimal karakter per baris. * terakhir plugins yang kita gunakan adalah prettier-plugin-tailwindcss untuk menyortir class-class tailwind yang kita gunakan.   Selanjutnya kita rubah file .eslintrc.json pada root project dengan data JSON berikut: { "extends": [ "next/core-web-vitals", "plugin:import/recommended", "plugin:prettier/recommended" ], "settings": { "import/resolver": { "typescript": true, "node": true } }, "plugins": ["prettier"], "rules": { "import/order": "warn", "prettier/prettier": [ "warn", { "endOfLine": "auto" } ], "react-hooks/exhaustive-deps": "off", "import/no-named-as-default-member": "off", "import/no-named-as-default": "off", "import/namespace": "off" } }   Untuk file .eslintrc.json ini intinya gua pakai plugin import/order untuk mengatur urutan module yang diimport. Sedangkan untuk plugin prettier berfungsi untuk mengatasi bentrokan konfigurasi .prettierrc.  Sisanya cuma matiin aturan-aturan yang agak mengganggu aja.   Agar Visual Studio kita bisa memformat dengan Prettier sekaligus memperbaiki ESLint ketika disave, kita perlu menginstall extension Prettier, ESLint dan membuat file settings.json di folder .vscode dengan data berikut: fullstack-next |--... |--/.vscode | |--settings.json |--...  { "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.formatOnSave": true, "editor.codeActionsOnSave": { "source.fixAll.eslint": "always" }, "[prisma]": { "editor.defaultFormatter": "Prisma.prisma" } }   Setup PrismaKarena kita mau buat project Full Stack menggunakan Database, kita perlu setup Prisma sebagai ORM kita. Jalankan command berikut di terminal root project: npx prisma init  Setelah menjalankan command di atas, akan muncul folder prisma di root projcet dengan satu file schema.prisma. Silahkan dikonfigurasi sesuai kebutuhan atau bisa pelajari di dokumentasi Pisma-nya.

post
Kamis, 25 Apr 2024

Cerita di balik FR Blog

Halo semua, sebelumnya kenalin gua Fathu Rahman, pembuat sekaligus penulis konten di FR Blog. Di Blog kali ini sebagai pengenalan, gua akan sharing ke kalian mengenai kenapa gua bikin web blog ini dan teknologi apa aja yg gua pake yang mungkin kalian juga pengen belajar gimana bikinnya.   Kenapa bikin FR Blog?Alasan gua bikin blog ini adalah karena gua ingin mendokumentasikan pemahaman yang gua dapet selama gua belajar ngoding.  Ketika gua belajar ngoding, ada aja something di suatu teknologi yang gua susah banget gua implementasiin. Akhirnya gua bisa ngulik seharian, gua nyari-nyari di blog-blog atau web komunitas kaya stackoverflow, atau bahkan gua juga nyoba-nyoba sendiri sampe akhirnya gua bisa. Nah, ketika gua ketemu solusinya itu, kayanya sayang banget kalo nggak gua sharing gitu ke yang laen. Karena bisa aja programmer laen ngalamin masalah yang sama jadi dia bisa terbantu dengan solusi yang gua temukan atau bahkan di kemudian hari malah gua yang lupa sendiri gimana cara dapetin solusi itu kalo gua nggak dokumentasiin. Termasuk dalam proses pembuatan FR Blog ini, banyak hal gua pelajari untuk membuat sebuah website sampe bisa akhirnya dideploy. Bahkan sampe saat gua nulis blog ini, FR Blog belum terindeks ama google, dan gua udah kepikiran untuk sharing ketika akhirnya FR Blog udah terindeks.    Sebenernya sebelum mau bikin blog, gua udah lebih dulu kepikiran untuk bikin channel YouTube. Tapi gua udah pernah nyoba saat itu bahas terkait matematika dan deep learning. Rasanya untuk bikin 1 video aja cukup memakan waktu yang panjang untuk persiapan dan take videonya, belum lagi ngeditnya. Apalagi saat ini gua udah berkeluarga, punya anak kecil, kayanya gk sempet gitu kalo lanjutin di YouTube. Ya semoga dengan FR Blog ini gua masih tetep bisa sharing ke kalian dan meskipun nanti yang baca dikit (🤣) gua sendiri bisa mendokumentasikan hasil belajar gua.    Teknologi yang digunakan FR BlogBagi kalian yang penasaran terkait Technology Stack yang gua pake untuk bikin FR Blog, berikut ringkasannya ya: * Fullstack NextJS 14 App Router * PostgreSQL Database hosted using Neon Tech * Prisma for ORM and DB Migration * Next Auth for Authentication * CKEditor as Text Rich Editor * TailwindCSS and Ant Design for Styling and UI Component * Vercel for web cloud hosting   Kalo kalian tertarik untuk implementasinya dari masing-masing stack tersebut silahkan komen dibawah (sekarang belom ada sih fitur komennya 🤣).   Konten SelanjutnyaUntuk blog selanjutnya gua udah kepikiran untuk sharing Design Pattern Fullstack NextJS yang gua pake untuk bikin FR Blog. nextnya mungkin terkait implementasi CKEditor di ReactJS dan di NextJS atau sekalian bikin studi kasus bikin web blog sederhana.   Thank you semuanya yang udah baca blog ini sampe abis. Doain supaya blog ini bisa cepet terindeks google biar gua makin semangat lagi bikin blognya 😁.  bye 😎

post
Selasa, 07 Mei 2024

Design Pattern Fullstack NextJS with App Router

Halo semua, kali ini gua mau sharing untuk setup Fullstack NextJS sesuai dengan Design Pattern yang gua akan sering pake di project Fullstack NextJS. Buat yang belum tau, Design Pattern menurut pemahaman gua adalah suatu aturan standar atau pola yang ditentukan di awal pengerjaan aplikasi mengenai penulisan kode program. Aturan standar tersebut meliputi penentuan struktur folder, gaya penulisan kode, aturan penggunaa git, dan lain-lain yang menunjang proses penulisan kode.   Tujuan dibuatnya Design Pattern ini adalah untuk memudahkan developer terutama yang berkerja dalam tim untuk menghasilkan kode yang bagus, yakni: * kode yang mudah dimengerti banyak developer bahkan yang di luar tim,  * kode yang mudah dilanjutkan proses pengembangannya dalam waktu jangka panjang, * dan yang cukup penting adalah kode yang mudah untuk di-fixing ketika ada bug karena cukup mudah mencari letak masalahnya. Selain itu ketika kita bekerja dalam tim, dengan adanya Design Pattern developer-developer akan cukup jelas bagaimana mereka harus menulis kode, bagian file-file mana saja yang menjadi tugasnya, dan bisa menghindari terhapusnya kode-kode developer lain secara tidak sengaja akibat penggunaan git yang kurang tepat.   Khusus di blog ini gua hanya membahas mengenai setup NextJS dengan konfigurasi TypeScript, ESLint, Prettier, husky + lintstage dan struktur folder yang gua terapkan.   Prerequisite * Install NodeJS minimum Versi 18.20.2 * Sudah pernah belajar React * Familiar dengan TypeScript * Terminal (git bash, cmd, powershell, dll) * Text Editor Visual Stuido Code   Setup NextJSInstall NextJSLangkah pertama gua akan menginstall NextJS melalui terminal dengan command berikut: npx create-next-app@14.2.3  Kemudian kalian bisa mengisi pertanyaan-pertanyaannya kaya gambar berikut atau sesuai dengan kebutuhan project kalian:     kalo udah berhasil terinstall kalian bisa masuk ke direktori project-nya, kemudian buka dengan Visual Studio Code cd ./fullstack-next code .  Selanjutnya kita install beberapa dependecies berikut dengan cara kalian copy file package.json berikut, kemudian paste ke package.json kalian yang ada di root project: fullstack-next |--... |--package.json |--...  { "name": "fullstack-next", "version": "0.1.0", "private": true, "scripts": { "dev": "next dev", "build": "next build", "start": "next start", "lint": "next lint" }, "dependencies": { "@prisma/client": "^5.13.0", "next": "14.2.3", "react": "^18", "react-dom": "^18", "winston": "^3.13.0" }, "devDependencies": { "@types/node": "^20", "@types/react": "^18", "@types/react-dom": "^18", "eslint": "^8", "eslint-config-next": "14.2.3", "eslint-config-prettier": "^9.1.0", "eslint-import-resolver-typescript": "^3.6.1", "eslint-plugin-import": "^2.29.1", "eslint-plugin-prettier": "^5.1.3", "husky": "^9.0.11", "lint-staged": "^15.2.2", "postcss": "^8", "prettier": "^3.2.5", "prettier-eslint": "^16.3.0", "prettier-plugin-tailwindcss": "^0.5.14", "prisma": "^5.13.0", "tailwindcss": "^3.4.1", "typescript": "^5" } }   Setup Prettier dan ESLintOke, pertama kita konfigurasi Prettier dan ESLint. Prettier ini berfungsi untuk memformat kode kita secara otomatis agar sesuai dengan konfigurasi yang kita tentukan seperti berapa jumlah spasi untuk indentasi tab, jumlah karakter perbaris, dan lain sebagainya. Sedangkan ESLint berfungsi sebagai Static Code Analysis untuk mengidentifikasi pola kode yang bermasalah pada kodingan JavaScript/TypeScript yang tidak sesuai dengan standar yang kita konfigurasi.    Buat file .prettierrc di root project dengan data JSON berikut: { "trailingComma": "all", "tabWidth": 2, "semi": true, "endOfLine": "auto", "printWidth": 80, "plugins": ["prettier-plugin-tailwindcss"] }   * trailingComma untuk menambahkan koma di akhir elemen object, array, dan argumen function. * tabWidth untuk menentukan jumlah spasi pada indentasi. * semi untuk menambahkan titik koma (;) di akhir kode. * endOfLine untuk menentukan akhir suatu baris (LF, CRLF, CR, Auto). * printWidth untuk menentukan maksimal karakter per baris. * terakhir plugins yang kita gunakan adalah prettier-plugin-tailwindcss untuk menyortir class-class tailwind yang kita gunakan.   Selanjutnya kita rubah file .eslintrc.json pada root project dengan data JSON berikut: { "extends": [ "next/core-web-vitals", "plugin:import/recommended", "plugin:prettier/recommended" ], "settings": { "import/resolver": { "typescript": true, "node": true } }, "plugins": ["prettier"], "rules": { "import/order": "warn", "prettier/prettier": [ "warn", { "endOfLine": "auto" } ], "react-hooks/exhaustive-deps": "off", "import/no-named-as-default-member": "off", "import/no-named-as-default": "off", "import/namespace": "off" } }   Untuk file .eslintrc.json ini intinya gua pakai plugin import/order untuk mengatur urutan module yang diimport. Sedangkan untuk plugin prettier berfungsi untuk mengatasi bentrokan konfigurasi .prettierrc.  Sisanya cuma matiin aturan-aturan yang agak mengganggu aja.   Agar Visual Studio kita bisa memformat dengan Prettier sekaligus memperbaiki ESLint ketika disave, kita perlu menginstall extension Prettier, ESLint dan membuat file settings.json di folder .vscode dengan data berikut: fullstack-next |--... |--/.vscode | |--settings.json |--...  { "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.formatOnSave": true, "editor.codeActionsOnSave": { "source.fixAll.eslint": "always" }, "[prisma]": { "editor.defaultFormatter": "Prisma.prisma" } }   Setup PrismaKarena kita mau buat project Full Stack menggunakan Database, kita perlu setup Prisma sebagai ORM kita. Jalankan command berikut di terminal root project: npx prisma init  Setelah menjalankan command di atas, akan muncul folder prisma di root projcet dengan satu file schema.prisma. Silahkan dikonfigurasi sesuai kebutuhan atau bisa pelajari di dokumentasi Pisma-nya.

post
Jumat, 19 Apr 2024

The Lightning Speed of AI Development: Unveiling the Rapid Advancements

Welcome to our blog! In this digital era, we are witnessing the lightning-fast development of artificial intelligence (AI). From groundbreaking advancements in machine learning to the integration of AI in various industries, this blog aims to explore the incredible speed at which AI is evolving. Join us as we uncover the latest achievements, trends, and potential implications of this rapidly expanding field.   1. Breakthroughs in Machine LearningMachine learning is at the forefront of AI development, enabling computers to learn from data and make predictions or decisions. This section will discuss notable breakthroughs in machine learning algorithms, such as deep learning and neural networks, that have led to significant advancements in AI capabilities. We'll explore how these breakthroughs have revolutionized areas such as computer vision, natural language processing, and autonomous systems.   2. Applications Across IndustriesAI's impact is not limited to a single industry—it is permeating various sectors at an astonishing pace. In this section, we'll delve into the wide-ranging applications of AI, including healthcare, finance, transportation, retail, and more. From AI-powered medical diagnostics to smart virtual assistants, we'll explore how AI is transforming industries, enhancing efficiency, and improving decision-making processes.   3. Ethical Considerations and ChallengesAs AI evolves rapidly, it raises important ethical considerations and challenges. This section will address topics such as bias in AI algorithms, data privacy, transparency, and the potential impact of AI on jobs and the workforce. We'll discuss the need for ethical guidelines and responsible AI development practices to ensure that the benefits of AI are maximized while minimizing potential risks.   4. Implications for the FutureThe rapid development of AI has profound implications for the future. In this section, we'll explore potential scenarios, including the advancement of AI in robotics, the emergence of augmented intelligence (AI working in collaboration with humans), and the potential for transformative changes in various aspects of society. We'll also discuss the importance of AI governance and the need for ongoing research and development.   5. Collaboration and Knowledge SharingThe speed of AI development necessitates collaboration and knowledge sharing among researchers, developers, and organizations. This section will emphasize the importance of fostering partnerships, promoting open-source initiatives, and encouraging interdisciplinary research. By working together, we can accelerate AI development and address challenges more effectively.   Conclusion:The rapid development of AI is transforming our world at an unprecedented pace. From breakthroughs in machine learning to applications across industries, AI's impact is undeniable. However, as AI continues to evolve rapidly, ethical considerations and challenges must be addressed. By fostering collaboration, promoting responsible development, and staying informed about the latest advancements, we can harness the potential of AI while ensuring a positive and inclusive future. Exciting times lie ahead as we witness the lightning speed of AI development and its potential to shape the world we live in.   Credits: Image by rawpixel.com on Freepik

post
Jumat, 19 Apr 2024

Preserving Your Mental Health in a Toxic Work Environment: Tips and Strategies

Welcome to our blog! In the world of work, we sometimes find ourselves in toxic environments that can have a negative impact on our mental health. In this blog, we will provide valuable tips and strategies to help you maintain your mental well-being, even in an unhealthy work environment. We hope this will assist you in facing challenges and maintaining emotional balance at work.   Recognize the Signs of a Toxic Work EnvironmentThe first step in preserving your mental health is to recognize the signs of a toxic work environment. In this section, we will discuss the characteristics of an unhealthy workplace, such as negative behavior, bullying, excessive competition, and lack of support. By identifying these signs, you can better prepare yourself to cope with them and take appropriate action.   Build a Support NetworkHaving a strong support network is crucial, especially in a toxic work environment. In this section, we will explore the importance of cultivating positive relationships with colleagues, seeking support from friends and family outside of work, and considering professional therapy or counseling if needed. Building a support system will provide you with a safe space to express your feelings and gain perspective on your experiences.   Practice Self-CareSelf-care plays a vital role in maintaining mental well-being. In this section, we will emphasize the importance of self-care practices such as setting boundaries, prioritizing your physical and emotional health, practicing mindfulness and relaxation techniques, and engaging in activities that bring you joy and fulfillment outside of work. Taking care of yourself will help you better cope with the challenges of a toxic work environment.   Develop Coping StrategiesHaving effective coping strategies is essential when dealing with a toxic work environment. In this section, we will discuss techniques such as practicing stress management, reframing negative thoughts, setting realistic expectations, and seeking outlets for expression, such as journaling or hobbies. These strategies will enable you to navigate difficult situations and protect your mental well-being.   Seek Professional Help if NeededIf the toxicity of your work environment becomes overwhelming and begins to significantly impact your mental health, it's important to seek professional help. This section will emphasize the importance of reaching out to mental health professionals who can provide guidance, support, and therapeutic interventions to help you cope with the challenges you face at work.   Conclusion:Maintaining your mental health in a toxic work environment can be challenging, but it is possible with the right strategies and support. By recognizing the signs of toxicity, building a support network, practicing self-care, developing coping strategies, and seeking professional help when needed, you can preserve your mental well-being and navigate through challenging work environments. Remember, your mental health should always be a priority, and you deserve to work in a healthy and supportive environment.

post
Jumat, 19 Apr 2024

Unleashing Your Potential: Tips and Tricks to Become a Successful Programmer

Welcome to our blog! If you're passionate about coding and aspire to become a successful programmer, you've come to the right place. In this blog, we will share valuable tips and tricks that will help you enhance your programming skills, boost your productivity, and navigate the ever-evolving world of coding. Whether you're a beginner or an experienced developer, these insights will guide you on your path to becoming a proficient programmer.   Mastering the FundamentalsEvery programmer's journey begins with a strong foundation. In this section, we will emphasize the importance of mastering the fundamentals of programming languages, algorithms, data structures, and problem-solving techniques. Building a solid understanding of these core concepts will provide you with a robust framework to tackle more complex programming challenges.   Embracing Continuous LearningThe field of programming is dynamic, with new languages, frameworks, and tools being introduced regularly. This section will highlight the significance of continuous learning in keeping up with the latest industry trends. We'll explore resources like online courses, tutorials, coding boot camps, and coding communities that can help you expand your knowledge and stay updated.   Developing Effective Problem-Solving SkillsProgramming is all about solving problems efficiently. This section will provide you with strategies and techniques to enhance your problem-solving abilities. We'll discuss approaches like breaking down complex problems into smaller, manageable tasks, leveraging debugging tools, and utilizing online resources and forums to find solutions. These skills will significantly contribute to your growth as a programmer.   Building a Diverse Project PortfolioPractical experience is invaluable in the programming world. This section will guide you in building a diverse project portfolio that showcases your skills and expertise. We'll discuss the importance of personal projects, open-source contributions, and collaborating on team projects. By working on different types of projects, you'll gain hands-on experience and demonstrate your ability to solve real-world problems.   Improving Code Efficiency and MaintainabilityWriting efficient and maintainable code is essential for becoming a successful programmer. In this section, we'll provide tips on optimizing code performance, adhering to coding standards, and utilizing design patterns and clean coding principles. These practices not only enhance the functionality of your code but also make it easier for others to understand and maintain.   Cultivating Soft SkillsIn addition to technical skills, soft skills play a vital role in your success as a programmer. This section will focus on developing effective communication, teamwork, time management, and problem-solving skills. We'll discuss the importance of collaborating with others, seeking feedback, and continuously improving your skills beyond coding.   Conclusion:Becoming a successful programmer requires dedication, continuous learning, and a passion for problem-solving. By mastering the fundamentals, embracing continuous learning, developing effective problem-solving skills, building a diverse project portfolio, improving code efficiency and maintainability, and cultivating soft skills, you'll be well on your way to achieving your goals as a programmer. Remember, the journey is ongoing, so embrace challenges and keep exploring new technologies and possibilities. Happy coding!   Credits: Photo by Danial Igdery on Unsplash

Fotografi

Lihat semua
post
Jumat, 19 Apr 2024

Mastering the Art of Videography: Tips for Aspiring Videographers

Welcome to our blog! If you have an interest in videography and dream of becoming a skilled videographer, you've come to the right place. In this blog, we will share valuable tips and advice to help you develop your videography skills. From project planning to effective editing techniques, this article will provide useful insights for aspiring videographers.   Set Goals and Find Your SpecializationThe first step in your journey as a videographer is to set goals and find an area of specialization that interests you. In this section, we will discuss the importance of identifying your interests and skills, as well as exploring different videography genres such as documentaries, commercials, weddings, or music videos. By finding your specialization, you can focus on developing relevant skills in that field.   Effective Project PlanningEffective project planning is crucial for a successful videography venture. In this section, we'll discuss the importance of pre-production activities such as conceptualizing ideas, storyboarding, location scouting, and creating shot lists. Proper planning will help you stay organized, save time, and ensure a smoother filming process.   Mastering Camera TechniquesAs a videographer, it's essential to have a strong grasp of camera techniques. This section will cover topics such as camera settings, framing, composition, capturing smooth shots, and utilizing different camera movements. Understanding these techniques will enable you to capture visually engaging footage that tells your story effectively.   Capturing High-Quality AudioGood audio quality is just as important as the visuals in videography. In this section, we'll explore techniques for capturing clear and professional-grade audio, including the use of external microphones, proper placement of microphones, and controlling ambient noise. Mastering audio recording will significantly enhance the overall quality of your videos.   Effective Video EditingVideo editing plays a crucial role in the final outcome of your videography projects. In this section, we'll discuss key editing techniques such as selecting the right software, organizing and importing footage, cutting and trimming clips, adding transitions and effects, and color grading. These skills will help you create visually appealing and polished videos.   Continuous Learning and ExperimentationVideography is a field that constantly evolves, and it's essential to keep learning and experimenting with new techniques and technologies. This section emphasizes the importance of continuous learning through online tutorials, workshops, and industry resources. Additionally, don't be afraid to experiment with different styles and approaches to develop your unique videography style.   Conclusion: Becoming a skilled videographer requires a combination of technical expertise, creativity, and continuous learning. By setting goals, finding your specialization, effective project planning, mastering camera techniques, capturing high-quality audio, honing your editing skills, and embracing continuous learning and experimentation, you'll be well on your way to mastering the art of videography. Remember, practice and persistence are key, so keep refining your skills and pushing the boundaries of your creativity. Happy filming!